diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue
index 79a070d..0981754 100644
--- a/pages/order/MyOrder/index.vue
+++ b/pages/order/MyOrder/index.vue
@@ -12,7 +12,7 @@
v-model="keyword"
:inputStyle="inputStyle"
:showAction="false"
- placeholder="请输入商品名/订单号/团购名称"
+ :placeholder="searchPlaceholder"
shape="round"
bgColor="#FFF"
@search="changeType"
@@ -76,28 +76,28 @@
- {{ order.merName }}
+ {{ getOrderStoreName(order) }}
-
+
- {{ order.merCityName }}
+ {{ getOrderCityName(order) }}
@@ -131,7 +131,7 @@
{{ (order.isGiftCardSend || order.isGiftCardReceive) ? '礼包' : (getStatus(order) || (order._status && order._status._title) || '已完成') }}
+ >{{ getOrderStatusTagText(order) }}
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+ ¥
+ {{ force2Decimal(item.price) }}
+
+ x{{ item.qty }}
+
+
+
+
+ {{ item.sku }}
+
+
+
+
+
@@ -300,8 +331,8 @@
{{ order.createTime }}
- 共{{ order.totalNum || 0 }}件商品
-
+ 共{{ getOrderTotalNum(order) }}件商品
+
,总金额
@@ -309,7 +340,7 @@
¥
- {{ force2Decimal(order.payPrice) }}
+ {{ force2Decimal(getOrderPayPrice(order)) }}
@@ -351,63 +382,101 @@
v-if="!order.isGiftCardSend && !order.experienceOrderInfo"
class="bottom flex jc-between ai-center"
>
-
-
- 更多
-
- 联系商家
- 申请退款
-
-
-
+
- 联系客服
-
联系商家
-
+
修改地址
+ 查看详情
申请退款
+ 确认收货
+ 删除订单
-
-
+
+
+ 更多
+
+ 联系商家
+ 申请退款
+
+
+
+
+ 联系客服
+
+
+ 联系商家
+
+
+ 查看详情
+ 删除订单
+
+
+
+
+
this.normalizeCollectiveDisplayItem(item, true))
+ }
+ if (this.isCollectiveWholesalerOrder(order)) {
+ return this.getCollectiveProductList(order).map(item => this.normalizeCollectiveDisplayItem(item))
+ }
+ return []
+ },
+ getCollectiveTotalNum(order) {
+ const totalNum = Number(order && order.totalNum)
+ if (totalNum > 0) {
+ return totalNum
+ }
+ return this.getCollectiveDisplayItems(order).reduce((sum, item) => sum + Number(item.qty || 0), 0)
+ },
+ getCollectiveProductImage(cart) {
+ const productInfo = (cart && cart.productInfo) || {}
+ const attrInfo = productInfo.attrInfo || {}
+ return productInfo.image || attrInfo.image || ''
+ },
+ getCollectiveProductName(cart) {
+ const productInfo = (cart && cart.productInfo) || {}
+ return productInfo.storeName || cart.storeName || '商品信息'
+ },
+ getCollectiveProductSku(cart) {
+ const productInfo = (cart && cart.productInfo) || {}
+ const attrInfo = productInfo.attrInfo || {}
+ return attrInfo.sku || cart.sku || ''
+ },
+ showCollectiveContact(order) {
+ const statusType = this.getCollectiveStatusType(order)
+ if (!this.isCollectiveWholesalerOrder(order)) {
+ return false
+ }
+ return Boolean(
+ (order.merName || order.storeName || order.merPhone || order.merId) &&
+ [1, 2, 4, -1, -2, -3].includes(statusType)
+ )
+ },
+ showCollectiveModifyAddress(order) {
+ const statusType = this.getCollectiveStatusType(order)
+ if (statusType !== 1) {
+ return false
+ }
+ if (!(this.isCollectiveWholesalerOrder(order) || this.isCollectiveCustomGiftOrder(order))) {
+ return false
+ }
+ return this.canShowModifyAddress(order)
+ },
+ showCollectiveDelete(order) {
+ return Number(order._status && order._status._type) === 9
+ },
+ showCollectiveTakeOrder(order) {
+ return this.getCollectiveStatusType(order) === 2
+ },
+ showCollectiveDetail(order) {
+ const statusType = this.getCollectiveStatusType(order)
+ if (this.isCollectiveCustomGiftOrder(order)) {
+ return [1, 4].includes(statusType)
+ }
+ if (this.isCollectiveWholesalerOrder(order)) {
+ return [1, 4, -1, -2, -3].includes(statusType)
+ }
+ return false
+ },
+ showCollectiveRefund(order) {
+ const statusType = this.getCollectiveStatusType(order)
+ if (!this.isCollectiveWholesalerOrder(order)) {
+ return false
+ }
+ return statusType === 2
+ },
isRefundFlow(order) {
if (!order) {
return false
@@ -1016,6 +1382,13 @@ export default {
}
return orderOrIndex
},
+ handleOrderStoreClick(orderOrIndex) {
+ const order = this.getOrderByIndex(orderOrIndex)
+ if (!order || this.isCollectiveCenterMode) {
+ return
+ }
+ this.goStore(order)
+ },
delOrder(orderOrIndex) {
const order = this.getOrderByIndex(orderOrIndex)
if (!order) {
@@ -1416,37 +1789,23 @@ export default {
},
tabChange(item) {
this.type = item.index
- this.$yroute.query.type = this.type
+ const query = this.getPageQuery()
+ query.type = this.type
this.changeType()
},
orderTypeTabChange(item) {
this.orderTypeTabIndex = item.index
this.orderType = item.orderType
+ const query = this.getPageQuery()
+ query.tabIndex = this.orderTypeTabIndex
this.updateTabListByOrderType()
+ if (this.type > this.tabList.length - 1) {
+ this.type = 0
+ }
this.changeType(this.type)
},
updateTabListByOrderType() {
- if (this.orderType === 'travel') {
- this.tabList = [
- { name: '全部' },
- { name: '待付款' },
- { name: '待确认' },
- { name: '待使用' },
- { name: '退款/售后' },
- { name: '待评价' },
- { name: '已完成' }
- ]
- } else {
- this.tabList = [
- { name: '全部' },
- { name: '待付款' },
- { name: '待发货' },
- { name: '待收货/待核销' },
- { name: '退款/售后' },
- { name: '待评价' },
- { name: '已完成' }
- ]
- }
+ this.tabList = this.getDefaultTabListByOrderType()
},
goUserCenter() {
this.$yrouter.switchTab({
@@ -1468,16 +1827,8 @@ export default {
uni.showLoading({
mask: true,
})
- const types = {
- 0: 0,
- 1: 1,
- 2: 2,
- 3: 3,
- 4: -3,
- 5: 4,
- 6: 5,
- }
- const type = types[this.type]
+ const typeMap = this.getRequestTypeMapByOrderType()
+ const type = typeMap[this.type]
const {
page,
limit,
diff --git a/pagesOrder/order/OrderDetails/index.vue b/pagesOrder/order/OrderDetails/index.vue
index 4b427ed..364e4f1 100644
--- a/pagesOrder/order/OrderDetails/index.vue
+++ b/pagesOrder/order/OrderDetails/index.vue
@@ -203,31 +203,31 @@
-
+
-
+
- {{ cart.productInfo.storeName }}
+ {{ cart.name }}
-
- {{ cart.productInfo.attrInfo.sku || '' }}
+
+ {{ cart.sku }}
{{ orderInfo.drawOrderInfo.prizeAttrName || '' }}
-
+
¥
- {{ cart.truePrice }}
+ {{ force2Decimal(cart.price) }}
- x{{ cart.cartNum }}
+ x{{ cart.qty }}
@@ -244,7 +244,7 @@
-
+
商品总价
@@ -500,7 +500,14 @@
-
+
+ 修改地址
+
+
联系客服
联系商家
@@ -515,7 +522,10 @@
-
+
+ 确认收货
+
+
联系客服
@@ -549,7 +559,11 @@
再买一单
- 立即评价
+ 立即评价
@@ -572,7 +586,7 @@
再买一单
立即评价
@@ -850,9 +864,10 @@ export default {
}
})
},
- goGoodsCon(item, isGiftCardReceiveBlind, isDrawOrder) {
+ goGoodsCon(item, isGiftCardReceiveBlind, isDrawOrder, scenarioCode) {
if(isGiftCardReceiveBlind) return
if(isDrawOrder) return
+ if (Number(scenarioCode) === 24) return
const activityId = Number(
item.drawActivityId ||
(item.productInfo && item.productInfo.drawActivityId) ||
@@ -1029,6 +1044,75 @@ export default {
}
return status;
},
+ getOrderScenarioCode(order = this.orderInfo) {
+ return Number(order && order.scenarioCode)
+ },
+ isWholesalerOrder(order = this.orderInfo) {
+ return this.getOrderScenarioCode(order) === 22
+ },
+ isCustomGiftOrder(order = this.orderInfo) {
+ return this.getOrderScenarioCode(order) === 24
+ },
+ isCollectiveOrder(order = this.orderInfo) {
+ return this.isWholesalerOrder(order) || this.isCustomGiftOrder(order)
+ },
+ canShowOrderEvaluate(order = this.orderInfo) {
+ return !this.isGiftOrder(order) && !this.isCollectiveOrder(order)
+ },
+ formatOrderDetailImage(image) {
+ const imageUrl = String(image || '').trim()
+ if (!imageUrl) {
+ return ''
+ }
+ if (/^https?:\/\//i.test(imageUrl)) {
+ return imageUrl
+ }
+ if (imageUrl.startsWith('//')) {
+ return `https:${imageUrl}`
+ }
+ if (imageUrl.startsWith('/')) {
+ const apiBaseUrl = String(this.$VUE_APP_API_URL || '').replace(/\/api\/?$/, '')
+ return `${apiBaseUrl}${imageUrl}`
+ }
+ return imageUrl
+ },
+ normalizeOrderDetailItem(item = {}, isCustomGift = false) {
+ if (isCustomGift) {
+ return {
+ image: this.formatOrderDetailImage(item.giftImage),
+ name: item.giftName || '商品信息',
+ sku: item.specName || '',
+ qty: Number(item.giftNum) || 1,
+ price: 0,
+ showPrice: false,
+ productId: '',
+ productInfo: {}
+ }
+ }
+ const productInfo = item.productInfo || {}
+ const attrInfo = productInfo.attrInfo || {}
+ return {
+ ...item,
+ image: this.formatOrderDetailImage(item.image || productInfo.image || attrInfo.image || ''),
+ name: productInfo.storeName || item.storeName || item.productName || '商品信息',
+ sku: attrInfo.sku || item.sku || item.specName || '',
+ qty: Number(item.cartNum || item.num || item.quantity || 1) || 1,
+ price: Number(item.truePrice || item.price || attrInfo.price || productInfo.price || 0) || 0,
+ showPrice: true,
+ productId: item.productId || productInfo.id || ''
+ }
+ },
+ getOrderDetailDisplayItems(order = this.orderInfo) {
+ if (this.isCustomGiftOrder(order)) {
+ const customGiftInfo = order && order.customGiftInfo
+ if (!customGiftInfo || typeof customGiftInfo !== 'object' || Array.isArray(customGiftInfo)) {
+ return []
+ }
+ return [this.normalizeOrderDetailItem(customGiftInfo, true)]
+ }
+ const cartList = Array.isArray(order && order.cartInfo) ? order.cartInfo : []
+ return cartList.map(item => this.normalizeOrderDetailItem(item))
+ },
getStatusImg(order) {
const type = parseInt(order._status._type);
let imgUrl = "";
@@ -1280,7 +1364,13 @@ export default {
this.orderInfo = res.data
this.orderInfo._status._type = parseInt(this.orderInfo._status._type)
this.getOrderStatus()
- if (this.orderInfo.combinationId > 0) {
+ if (this.isWholesalerOrder(this.orderInfo)) {
+ this.orderTypeName = "采购批发订单"
+ this.orderTypeNameStatus = false
+ } else if (this.isCustomGiftOrder(this.orderInfo)) {
+ this.orderTypeName = "自建礼品订单"
+ this.orderTypeNameStatus = false
+ } else if (this.orderInfo.combinationId > 0) {
this.orderTypeName = "拼团订单"
this.orderTypeNameStatus = false
} else if (this.orderInfo.bargainId > 0) {