Feat:集采中心采购订单
This commit is contained in:
@@ -203,31 +203,31 @@
|
||||
|
||||
<view style="margin-top: 30rpx;border-radius:20rpx;overflow: hidden;" class="v12-white">
|
||||
<!-- <OrderGoods :evaluate="status.type || 0" :cartInfo="orderInfo.cartInfo || []" title="商品信息"></OrderGoods> -->
|
||||
<view class="v12-radius-20 v12-pa-3" v-for="(cart, d) in orderInfo.cartInfo" :key="d" @click="goGoodsCon(cart, orderInfo.isGiftCardReceiveBlind, orderInfo.isDrawOrder)">
|
||||
<view class="v12-radius-20 v12-pa-3" v-for="(cart, d) in getOrderDetailDisplayItems(orderInfo)" :key="d" @click="goGoodsCon(cart, orderInfo.isGiftCardReceiveBlind, orderInfo.isDrawOrder, orderInfo.scenarioCode)">
|
||||
<view class="v12-justify-between" v-if="orderInfo.isGiftCardReceiveBlind === 0">
|
||||
<view class="">
|
||||
<image style="width: 120rpx; height: 120rpx" class="v12-radius-8" :src="cart.productInfo.image"></image>
|
||||
<image style="width: 120rpx; height: 120rpx" class="v12-radius-8" :src="cart.image"></image>
|
||||
</view>
|
||||
<view class="v12-justify-between v12-flex-column v12-ml-2" style="flex: 2">
|
||||
<view class="v12-font-28 v12-dark-text v12-font-bold more-t">
|
||||
{{ cart.productInfo.storeName }}
|
||||
{{ cart.name }}
|
||||
</view>
|
||||
<view v-if="cart.productInfo.attrInfo && orderInfo.isDrawOrder !== 1" class="more-t v12-secondary-dark-text v12-font-24">
|
||||
{{ cart.productInfo.attrInfo.sku || '' }}
|
||||
<view v-if="cart.sku && orderInfo.isDrawOrder !== 1" class="more-t v12-secondary-dark-text v12-font-24">
|
||||
{{ cart.sku }}
|
||||
</view>
|
||||
<view v-if="orderInfo.isDrawOrder === 1" class="more-t v12-secondary-dark-text v12-font-24">
|
||||
{{ orderInfo.drawOrderInfo.prizeAttrName || '' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="v12-justify-between v12-flex-column v12-dark-text v12-text-right">
|
||||
<view class=" " v-if="orderInfo.isDrawOrder === 0">
|
||||
<view class=" " v-if="orderInfo.isDrawOrder === 0 && cart.showPrice">
|
||||
<text class="v12-font-22">
|
||||
¥
|
||||
</text>
|
||||
<text class="v12-font-28">{{ cart.truePrice }}</text>
|
||||
<text class="v12-font-28">{{ force2Decimal(cart.price) }}</text>
|
||||
</view>
|
||||
<view class="v12-font-22">
|
||||
<text>x{{ cart.cartNum }}</text>
|
||||
<text>x{{ cart.qty }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -244,7 +244,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" v-if="orderInfo.cartInfo &&( d === orderInfo.cartInfo.length - 1) && orderInfo.isDrawOrder === 0">
|
||||
<view class="" v-if="getOrderDetailDisplayItems(orderInfo).length && (d === getOrderDetailDisplayItems(orderInfo).length - 1) && orderInfo.isDrawOrder === 0">
|
||||
<view class="v12-justify-between v12-align-center v12-mt-3 v12-dark-text" v-if="orderInfo.isGiftCardReceiveBlind === 0">
|
||||
<view class="v12-font-24 v12-dark-text">
|
||||
商品总价
|
||||
@@ -500,7 +500,14 @@
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="status.type == 1" >
|
||||
<view class="v12-justify-between " style="width: 100%">
|
||||
<view v-if="isCustomGiftOrder(orderInfo)" class="v12-justify-end" style="width: 100%">
|
||||
<view
|
||||
v-if="canShowModifyAddress(orderInfo) && orderInfo.isDrawOrder === 0"
|
||||
class="bnt v12-dark-text v12-dark-border cancel"
|
||||
@click="goAddress"
|
||||
>修改地址</view>
|
||||
</view>
|
||||
<view v-else class="v12-justify-between " style="width: 100%">
|
||||
<view class="v12-justify-between ">
|
||||
<view v-if="orderInfo.isDrawOrder > 0" class="bnt v12-dark-text v12-dark-border cancel" @click.stop="callMerPhone">联系客服</view>
|
||||
<view v-if="orderInfo.isGiftCardReceiveBlind === 0 && orderInfo.isDrawOrder === 0" class="bnt v12-dark-text v12-dark-border cancel" @click="goRoom(orderInfo)">联系商家</view>
|
||||
@@ -515,7 +522,10 @@
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="status.type == 2">
|
||||
<view class="v12-justify-between " style="width: 100%">
|
||||
<view v-if="isCustomGiftOrder(orderInfo)" class="v12-justify-end" style="width: 100%">
|
||||
<view class="bnt v12-primary-text v12-primary-border" @click="takeOrder">确认收货</view>
|
||||
</view>
|
||||
<view v-else class="v12-justify-between " style="width: 100%">
|
||||
<view v-if="orderInfo.isGiftCardReceiveBlind === 0" class="bnt v12-dark-text v12-dark-border cancel" @click.stop="callMerPhone">联系客服</view>
|
||||
<view class="" v-else></view>
|
||||
<view class="v12-justify-between">
|
||||
@@ -549,7 +559,11 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="bnt v12-dark-text v12-dark-border cancel" @click="buyAgin">再买一单</view>
|
||||
<view class="bnt v12-primary-text v12-primary-border" @click="routerGo(orderInfo.cartInfo[0])">立即评价</view>
|
||||
<view
|
||||
v-if="canShowOrderEvaluate(orderInfo)"
|
||||
class="bnt v12-primary-text v12-primary-border"
|
||||
@click="routerGo(orderInfo.cartInfo[0])"
|
||||
>立即评价</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -572,7 +586,7 @@
|
||||
|
||||
<view class="bnt v12-dark-text v12-dark-border cancel" @click="buyAgin">再买一单</view>
|
||||
<view
|
||||
v-if="!isGiftOrder(orderInfo)"
|
||||
v-if="canShowOrderEvaluate(orderInfo)"
|
||||
class="bnt v12-primary-text v12-primary-border"
|
||||
@click="routerGo(orderInfo.cartInfo[0])"
|
||||
>立即评价</view>
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user