Commit 5693c008 by 李伟康

feat(OrderPopup): 支持战败订单商品列表展示

- 新增战败订单商品列表获取接口和相关组件逻辑
- 优化商品列表展示,支持按商品类型分类展示
- 添加商品部位信息展示逻辑
- 修复战败订单商品价格显示问题
- 优化优惠券列表展示逻辑
- 调整汽车型号列表展示样式
1 parent bf33bff5
...@@ -75,11 +75,32 @@ module.exports = { ...@@ -75,11 +75,32 @@ module.exports = {
/** /**
* 获取园区店配置 * 获取园区店配置
*/ */
getYqStoreConfig(data){ getYqStoreConfig (data) {
return http.get({ return http.get({
method: 'dj.api.smarcarlife.yqMerchantConfig.detail', method: 'dj.api.smarcarlife.yqMerchantConfig.detail',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
},
/**
* 战败下单商品列表
*
*/
getOrderUpgradeGoodsList (data) {
return http.post({
method: 'dj.api.smartcarlife.orderUpgradeGoods.listByMerchantId',
projectName: 'boutique',
...data
})
},
/**
* 获取精品升级场景 太阳膜类商品部位数据
*/
getPositionList (data) {
return http.post({
method: 'dj.api.smartcarlife.goodsPosition.list',
projectName: 'boutique',
...data
})
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,42 +5,44 @@ ...@@ -5,42 +5,44 @@
scroll-y scroll-y
:scroll-into-view="letter" :scroll-into-view="letter"
> >
<template v-for="(i, index) in (searchStatus ? searchList : list)"> <template v-if="listData.length">
<view <template v-for="(i, index) in listData">
class="item-box" <view
:key="index" class="item-box"
:id="i.letter" :key="index"
> :id="i.letter"
<view class="letter-title flex">{{i.letter}}</view> >
<template v-for="(c,cindex) in i.list"> <view class="letter-title flex">{{i.letter}}</view>
<view <template v-for="(c,cindex) in i.list">
class="car-model" <view
:key="cindex" class="car-model"
> :key="cindex"
<view class="brand-name">{{c.name}}</view> >
<view class="brand-list"> <view class="brand-name">{{c.name}}</view>
<template v-for="(j, jindex) in c.childs_list"> <view class="brand-list">
<view <template v-for="(j, jindex) in c.childs_list">
:key="jindex" <view
:class="[ :key="jindex"
:class="[
{'sub-brand-name':j.isTitle}, {'sub-brand-name':j.isTitle},
{'item flex':!j.isTitle}, {'item flex':!j.isTitle},
{active: (currentId ? j.id == currentId : j.id == data.customer[params.idKey]) && !j.isTitle} {active: (currentId ? j.id == currentId : j.id == data.customer[params.idKey]) && !j.isTitle}
]" ]"
@click="choose(j,c)" @click="choose(j,c)"
> >
<view <view
class="sprite-icon icon-tag-checked" class="sprite-icon icon-tag-checked"
v-if="!j.isTitle" v-if="!j.isTitle"
></view> ></view>
{{j.name}} {{j.name}}
</view> </view>
</template> </template>
</view>
</view> </view>
</view> </template>
</template>
</view> </view>
</template>
</template> </template>
</scroll-view> </scroll-view>
<view class="letter-list"> <view class="letter-list">
......
<template> <template>
<view class="coupon-box"> <view class="coupon-box">
<template v-if="customerCouponList.length"> <template v-if="params.loadComplete">
<view class="item-box"> <template v-if="customerCouponList.length">
<view class="coupon-title flex">客户拥有的券</view> <view class="item-box">
<view class="coupon-list"> <view class="coupon-title flex">客户拥有的券</view>
<template v-for="(c,cindex) in customerCouponList"> <view class="coupon-list">
<view <template v-for="(c,cindex) in customerCouponList">
:key="cindex" <view
:class="[ :key="cindex"
:class="[
'item flex', 'item flex',
{active: currentId ? c.customerCouponCode == currentId : c.customerCouponCode == data[params.idKey]}, {active: currentId ? c.customerCouponCode == currentId : c.customerCouponCode == data[params.idKey]},
]" ]"
@click="choose(c,true)" @click="choose(c,true)"
> >
<view class="sprite-icon icon-tag-checked"></view> <view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.customerCouponCode}} {{c.couponName}}{{c.customerCouponCode}}
</view> </view>
</template> </template>
</view>
</view> </view>
</view> </template>
</template> <template v-if="listData.length">
<template v-for="(i, index) in (searchStatus ? searchList : list)"> <template v-for="(i, index) in listData">
<view <view
class="item-box" class="item-box"
:key="index" :key="index"
> >
<view class="coupon-title flex">{{i.title}}</view> <view class="coupon-title flex">{{i.title}}</view>
<view class="coupon-list"> <view class="coupon-list">
<template v-for="(c,cindex) in i.list"> <template v-for="(c,cindex) in i.list">
<view <view
:key="cindex" :key="cindex"
:class="[ :class="[
'item flex', 'item flex',
{active: currentId ? c.merchantCouponCode == currentId : c.merchantCouponCode == data[params.idKey]}, {active: currentId ? c.merchantCouponCode == currentId : c.merchantCouponCode == data[params.idKey]},
{disabled:checkDisabled(c) } {disabled:checkDisabled(c) }
]" ]"
@click="choose(c)" @click="choose(c)"
> >
<view class="sprite-icon icon-tag-checked"></view> <view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.merchantCouponCode}} {{c.couponName}}{{c.merchantCouponCode}}
</view>
</template>
</view> </view>
</template> </view>
</view> </template>
</view> </template>
</template> </template>
</view> </view>
</template> </template>
......
<template> <template>
<view class="goods-list"> <view :class="['goods-list',{'is-defeat-order':isDefeatOrder}]">
<!-- <template v-if="list.length"> --> <template v-if="params.loadComplete">
<template v-for="(i, index) in (searchStatus ? searchList : list)"> <template v-if="listData.length">
<view <template v-for="(i, index) in listData">
:key="index" <template v-if="isDefeatOrder">
@click="choose(i)" <view
:class="['item flex',{active: checkActive(i)}]" class="item-box"
> :key="index"
<view class="sprite-icon icon-tag-checked"></view> >
<text class="goods-name text-hide"> <view class="goods-title flex">{{i.goodsTypeName}}|建议价</view>
{{replaceItemText(i.goods,'goodsAlias') ||replaceItemText(i.goods,'upgradeGoodsName') || replaceItemText(i.goodsInfo,'goodsName')}} <view class="defeat-goods-list">
</text> <template v-for="(item,ind) in i.upgradeGoodsList">
<template v-if="i.goods.merchantGoodsPosition && (i.goods.goodsInfo.goodsType == 1 || i.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)"> <view
<text>「{{ i.goods.positionStr}}」</text> :class="['item flex',{active:checkActive(item)}]"
:key="`${index}_${ind}`"
@click="choose(item)"
>
<view class="sprite-icon icon-tag-checked"></view>
<text class="goods-name text-hide">
{{replaceItemText(item, 'upgradeGoodsAlias') ||replaceItemText(item,'upgradeGoodsName') || replaceItemText(item.goodsInfo, 'goodsName')}}
</text>
<template v-if="item.merchantGoodsPosition && (item.goodsInfo.goodsType == 1 || item.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)">
<text>「{{ item.positionStr}}」</text>
</template>
<template v-if="!item.merchantGoodsPosition && (item.goodsInfo.goodsType == 1 || item.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)">
<view class="no-postion">无部位</view>
</template>
<text class="price">¥{{item.upgradePrice}}</text>
</view>
</template>
</view>
</view>
</template>
<template v-else>
<view
:key="index"
@click="choose(i)"
:class="['item flex',{active: checkActive(i)}]"
>
<view class="sprite-icon icon-tag-checked"></view>
<text class="goods-name text-hide">
{{replaceItemText(i.goods,'goodsAlias') ||replaceItemText(i.goods,'upgradeGoodsName') || replaceItemText(i.goodsInfo,'goodsName')}}
</text>
<template v-if="i.goods.merchantGoodsPosition && (i.goods.goodsInfo.goodsType == 1 || i.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType)">
<text>「{{ i.goods.positionStr}}」</text>
</template>
<text class="price">¥{{i.goods.price}}</text>
</view>
</template>
</template> </template>
<text class="price">¥{{isDefeatOrder? 0 :i.goods.price}}</text> </template>
</view>
</template> </template>
<!-- </template> -->
</view> </view>
</template> </template>
...@@ -34,8 +67,10 @@ export default { ...@@ -34,8 +67,10 @@ export default {
}, },
methods: { methods: {
async getList (searchValue) { async getList (searchValue) {
const { userInfo, params } = this, const { userInfo, params, isDefeatOrder } = this,
{ shopMerchantId, sceneType } = userInfo,
{ cacheData } = params { cacheData } = params
this.currentIds = [] this.currentIds = []
this.chooseList = [] this.chooseList = []
if (cacheData && cacheData.length) { if (cacheData && cacheData.length) {
...@@ -43,11 +78,12 @@ export default { ...@@ -43,11 +78,12 @@ export default {
if (searchValue) this.handleSearch(searchValue) if (searchValue) this.handleSearch(searchValue)
return return
} }
const { shopMerchantId, sceneType } = userInfo, let apiName = isDefeatOrder ? 'getOrderUpgradeGoodsList' : 'getGoodsList',
data = await uni.$api.popupApi.getGoodsList({ apiParams = {
merchantId: shopMerchantId, merchantId: shopMerchantId
sceneType }
}) isDefeatOrder ? apiParams.upradeFlag = 'N' : apiParams.sceneType = sceneType
const data = await uni.$api.popupApi[apiName](apiParams)
if (data && data.length) this.updateParams(params, data) if (data && data.length) this.updateParams(params, data)
}, },
handleSearch (searchValue) { handleSearch (searchValue) {
...@@ -68,36 +104,69 @@ export default { ...@@ -68,36 +104,69 @@ export default {
} }
}, },
initData (goodsData) { initData (goodsData) {
let { goodsType } = this.params, let { data, dataKey, isDefeatOrder, baseConfigData, positionTypeList } = this,
{ data, dataKey } = this, { goodsType } = this.params,
arr = [] arr = []
goodsData.map(val => { if (isDefeatOrder) {
if (val.goodsFlag == 1) { let arrData = []
let subVal = val.goods goodsData?.forEach(val => {
subVal.positionStr = subVal.position if ([1, baseConfigData?.selfBuildFilmType].includes(val.goodsType))
subVal.upgradePrice = subVal.sellPrice arrData.push(val)
subVal.price = subVal.sellPrice })
subVal.goodsId = subVal.merchantGoodsId arrData.map(val => {
if (goodsType.includes(subVal.merchantGoodsPosition)) arr.push(val) if (val.goodsType == 1 || val.goodsType == baseConfigData?.selfBuildFilmType) {
} arr.push({
}) goodsType: val.goodsType,
let paramsData = dataKey ? data[dataKey] : data goodsTypeName: val.goodsTypeName,
if (paramsData && paramsData.length) paramsData.map(e => { upgradeGoodsList: []
this.currentIds.push(e.goods.goodsId) })
this.chooseList.push(e) for (var i = 0; i < arr?.length; i++) {
}) val?.upgradeGoodsList?.forEach(subVal => {
subVal.positionStr = positionTypeList.filter(
v => v.positionValue == subVal.merchantGoodsPosition
)[0]?.positionName
subVal.price = 0
subVal.shopMinPrice = 0
subVal.upgradePrice = 0
subVal.totalPrice = 0
subVal.number = 1
if (goodsType.includes(subVal.merchantGoodsPosition)) arr[i].upgradeGoodsList.push(subVal)
});
if (!arr[i]?.upgradeGoodsList?.length) arr.splice(i, 1);
}
}
})
} else {
goodsData.map(val => {
if (val.goodsFlag == 1) {
let subVal = val.goods
subVal.positionStr = subVal.position
subVal.upgradePrice = subVal.sellPrice
subVal.price = subVal.sellPrice
subVal.goodsId = subVal.merchantGoodsId
if (goodsType.includes(subVal.merchantGoodsPosition)) arr.push(val)
}
})
let paramsData = dataKey ? data[dataKey] : data
if (paramsData && paramsData.length) paramsData.map(e => {
this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e)
})
}
this.$emit('onComplete') this.$emit('onComplete')
this.list = arr this.list = arr
}, },
choose (i) { choose (i) {
let { goodsId } = i.goods, let { currentIds, isDefeatOrder } = this,
{ currentIds } = this, id = ''
index = currentIds.indexOf(goodsId) if (isDefeatOrder) id = i.id
else id = i.goods.goodsId
let index = currentIds.indexOf(id)
if (index == -1) { if (index == -1) {
this.currentIds.push(goodsId) this.currentIds.push(id)
this.chooseList.push(i) this.chooseList.push(i)
} } else {
else {
this.currentIds.splice(index, 1) this.currentIds.splice(index, 1)
this.chooseList.splice(index, 1) this.chooseList.splice(index, 1)
} }
...@@ -109,9 +178,12 @@ export default { ...@@ -109,9 +178,12 @@ export default {
return value ? value.replace(reg, ' ') : '' return value ? value.replace(reg, ' ') : ''
}, },
checkActive (i) { checkActive (i) {
let { currentIds } = this, let { currentIds, isDefeatOrder } = this,
id = '',
active = false active = false
if (currentIds.length) active = currentIds.includes(i.goods.goodsId) if (isDefeatOrder) id = i.id
else id = i.goods.goodsId
if (currentIds.length) active = currentIds.includes(id)
return active return active
} }
} }
...@@ -157,4 +229,57 @@ export default { ...@@ -157,4 +229,57 @@ export default {
} }
} }
} }
.is-defeat-order {
display: block;
margin: 0;
.item-box {
margin-bottom: 32rpx;
.goods-title {
color: #888888;
font-size: 28rpx;
height: 40rpx;
background: #f5f7fa;
padding-left: 48rpx;
margin-bottom: 16rpx;
}
.defeat-goods-list {
gap: 32rpx;
display: flex;
flex-wrap: wrap;
margin: 0 48rpx;
.item {
width: calc((100% - 32rpx) / 2);
justify-content: center;
min-height: 72rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
padding: 14rpx 16rpx;
word-break: break-all;
text-align: center;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.disabled {
border: 2rpx solid #dce0e666;
color: #3333331a;
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -14,7 +14,8 @@ export default { ...@@ -14,7 +14,8 @@ export default {
params: Object, params: Object,
data: [Object, Array], data: [Object, Array],
dataKey: String, dataKey: String,
isDefeatOrder: Boolean isDefeatOrder: Boolean,
positionTypeList: Array,
}, },
computed: { computed: {
listData () { listData () {
...@@ -41,7 +42,7 @@ export default { ...@@ -41,7 +42,7 @@ export default {
params.cacheData = data params.cacheData = data
} }
this.$emit('update:params', params) this.$emit('update:params', params)
} }
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
:data="data" :data="data"
:dataKey="dataKey" :dataKey="dataKey"
:isDefeatOrder="isDefeatOrder" :isDefeatOrder="isDefeatOrder"
:positionTypeList="positionTypeList"
ref="componentRef" ref="componentRef"
@choose="chooseContent = $event" @choose="chooseContent = $event"
@openSkuPopup="openSkuPopup" @openSkuPopup="openSkuPopup"
...@@ -129,7 +130,7 @@ export default { ...@@ -129,7 +130,7 @@ export default {
provide () { provide () {
return { return {
userInfo: this.userInfo, userInfo: this.userInfo,
baseConfigData: this.baseConfigData baseConfigData: this.baseConfigData,
} }
}, },
data () { data () {
...@@ -137,6 +138,7 @@ export default { ...@@ -137,6 +138,7 @@ export default {
position: 'bottom', position: 'bottom',
chooseContent: null, chooseContent: null,
componentObject: config.componentConfig, componentObject: config.componentConfig,
positionTypeList:[]
} }
}, },
watch: { watch: {
...@@ -150,15 +152,20 @@ export default { ...@@ -150,15 +152,20 @@ export default {
}, },
externalData: { externalData: {
handler (val) { handler (val) {
if (val) {
}
if (val && val.length && this.componentObject[this.popupType]) { if (val && val.length && this.componentObject[this.popupType]) {
this.componentObject[this.popupType].cacheData = val this.componentObject[this.popupType].cacheData = val
} }
}, },
deep: true, deep: true,
immediate: true immediate: true
},
isDefeatOrder: {
async handler (val) {
if (val) {
this.positionTypeList = await uni.$api.popupApi.getPositionList()
}
},
immediate: true
} }
}, },
computed: { computed: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!