Commit 5693c008 by 李伟康

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

- 新增战败订单商品列表获取接口和相关组件逻辑
- 优化商品列表展示,支持按商品类型分类展示
- 添加商品部位信息展示逻辑
- 修复战败订单商品价格显示问题
- 优化优惠券列表展示逻辑
- 调整汽车型号列表展示样式
1 parent bf33bff5
......@@ -75,11 +75,32 @@ module.exports = {
/**
* 获取园区店配置
*/
getYqStoreConfig(data){
getYqStoreConfig (data) {
return http.get({
method: 'dj.api.smarcarlife.yqMerchantConfig.detail',
projectName: 'boutique',
...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
......@@ -5,42 +5,44 @@
scroll-y
:scroll-into-view="letter"
>
<template v-for="(i, index) in (searchStatus ? searchList : list)">
<view
class="item-box"
:key="index"
:id="i.letter"
>
<view class="letter-title flex">{{i.letter}}</view>
<template v-for="(c,cindex) in i.list">
<view
class="car-model"
:key="cindex"
>
<view class="brand-name">{{c.name}}</view>
<view class="brand-list">
<template v-for="(j, jindex) in c.childs_list">
<view
:key="jindex"
:class="[
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<view
class="item-box"
:key="index"
:id="i.letter"
>
<view class="letter-title flex">{{i.letter}}</view>
<template v-for="(c,cindex) in i.list">
<view
class="car-model"
:key="cindex"
>
<view class="brand-name">{{c.name}}</view>
<view class="brand-list">
<template v-for="(j, jindex) in c.childs_list">
<view
:key="jindex"
:class="[
{'sub-brand-name':j.isTitle},
{'item flex':!j.isTitle},
{active: (currentId ? j.id == currentId : j.id == data.customer[params.idKey]) && !j.isTitle}
]"
@click="choose(j,c)"
>
<view
class="sprite-icon icon-tag-checked"
v-if="!j.isTitle"
></view>
{{j.name}}
</view>
</template>
@click="choose(j,c)"
>
<view
class="sprite-icon icon-tag-checked"
v-if="!j.isTitle"
></view>
{{j.name}}
</view>
</template>
</view>
</view>
</view>
</template>
</template>
</view>
</view>
</template>
</template>
</scroll-view>
<view class="letter-list">
......
<template>
<view class="coupon-box">
<template v-if="customerCouponList.length">
<view class="item-box">
<view class="coupon-title flex">客户拥有的券</view>
<view class="coupon-list">
<template v-for="(c,cindex) in customerCouponList">
<view
:key="cindex"
:class="[
<template v-if="params.loadComplete">
<template v-if="customerCouponList.length">
<view class="item-box">
<view class="coupon-title flex">客户拥有的券</view>
<view class="coupon-list">
<template v-for="(c,cindex) in customerCouponList">
<view
:key="cindex"
:class="[
'item flex',
{active: currentId ? c.customerCouponCode == currentId : c.customerCouponCode == data[params.idKey]},
]"
@click="choose(c,true)"
>
<view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.customerCouponCode}}
</view>
</template>
@click="choose(c,true)"
>
<view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.customerCouponCode}}
</view>
</template>
</view>
</view>
</view>
</template>
<template v-for="(i, index) in (searchStatus ? searchList : list)">
<view
class="item-box"
:key="index"
>
<view class="coupon-title flex">{{i.title}}</view>
<view class="coupon-list">
<template v-for="(c,cindex) in i.list">
<view
:key="cindex"
:class="[
</template>
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<view
class="item-box"
:key="index"
>
<view class="coupon-title flex">{{i.title}}</view>
<view class="coupon-list">
<template v-for="(c,cindex) in i.list">
<view
:key="cindex"
:class="[
'item flex',
{active: currentId ? c.merchantCouponCode == currentId : c.merchantCouponCode == data[params.idKey]},
{disabled:checkDisabled(c) }
]"
@click="choose(c)"
>
<view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.merchantCouponCode}}
@click="choose(c)"
>
<view class="sprite-icon icon-tag-checked"></view>
{{c.couponName}}{{c.merchantCouponCode}}
</view>
</template>
</view>
</template>
</view>
</view>
</view>
</template>
</template>
</template>
</view>
</template>
......
<template>
<view class="goods-list">
<!-- <template v-if="list.length"> -->
<template v-for="(i, index) in (searchStatus ? searchList : list)">
<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>
<view :class="['goods-list',{'is-defeat-order':isDefeatOrder}]">
<template v-if="params.loadComplete">
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<template v-if="isDefeatOrder">
<view
class="item-box"
:key="index"
>
<view class="goods-title flex">{{i.goodsTypeName}}|建议价</view>
<view class="defeat-goods-list">
<template v-for="(item,ind) in i.upgradeGoodsList">
<view
: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>
<text class="price">¥{{isDefeatOrder? 0 :i.goods.price}}</text>
</view>
</template>
</template>
<!-- </template> -->
</view>
</template>
......@@ -34,8 +67,10 @@ export default {
},
methods: {
async getList (searchValue) {
const { userInfo, params } = this,
const { userInfo, params, isDefeatOrder } = this,
{ shopMerchantId, sceneType } = userInfo,
{ cacheData } = params
this.currentIds = []
this.chooseList = []
if (cacheData && cacheData.length) {
......@@ -43,11 +78,12 @@ export default {
if (searchValue) this.handleSearch(searchValue)
return
}
const { shopMerchantId, sceneType } = userInfo,
data = await uni.$api.popupApi.getGoodsList({
merchantId: shopMerchantId,
sceneType
})
let apiName = isDefeatOrder ? 'getOrderUpgradeGoodsList' : 'getGoodsList',
apiParams = {
merchantId: shopMerchantId
}
isDefeatOrder ? apiParams.upradeFlag = 'N' : apiParams.sceneType = sceneType
const data = await uni.$api.popupApi[apiName](apiParams)
if (data && data.length) this.updateParams(params, data)
},
handleSearch (searchValue) {
......@@ -68,36 +104,69 @@ export default {
}
},
initData (goodsData) {
let { goodsType } = this.params,
{ data, dataKey } = this,
let { data, dataKey, isDefeatOrder, baseConfigData, positionTypeList } = this,
{ goodsType } = this.params,
arr = []
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)
})
if (isDefeatOrder) {
let arrData = []
goodsData?.forEach(val => {
if ([1, baseConfigData?.selfBuildFilmType].includes(val.goodsType))
arrData.push(val)
})
arrData.map(val => {
if (val.goodsType == 1 || val.goodsType == baseConfigData?.selfBuildFilmType) {
arr.push({
goodsType: val.goodsType,
goodsTypeName: val.goodsTypeName,
upgradeGoodsList: []
})
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.list = arr
},
choose (i) {
let { goodsId } = i.goods,
{ currentIds } = this,
index = currentIds.indexOf(goodsId)
let { currentIds, isDefeatOrder } = this,
id = ''
if (isDefeatOrder) id = i.id
else id = i.goods.goodsId
let index = currentIds.indexOf(id)
if (index == -1) {
this.currentIds.push(goodsId)
this.currentIds.push(id)
this.chooseList.push(i)
}
else {
} else {
this.currentIds.splice(index, 1)
this.chooseList.splice(index, 1)
}
......@@ -109,9 +178,12 @@ export default {
return value ? value.replace(reg, ' ') : ''
},
checkActive (i) {
let { currentIds } = this,
let { currentIds, isDefeatOrder } = this,
id = '',
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
}
}
......@@ -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>
\ No newline at end of file
......@@ -14,7 +14,8 @@ export default {
params: Object,
data: [Object, Array],
dataKey: String,
isDefeatOrder: Boolean
isDefeatOrder: Boolean,
positionTypeList: Array,
},
computed: {
listData () {
......@@ -41,7 +42,7 @@ export default {
params.cacheData = data
}
this.$emit('update:params', params)
}
}
......
......@@ -53,6 +53,7 @@
:data="data"
:dataKey="dataKey"
:isDefeatOrder="isDefeatOrder"
:positionTypeList="positionTypeList"
ref="componentRef"
@choose="chooseContent = $event"
@openSkuPopup="openSkuPopup"
......@@ -129,7 +130,7 @@ export default {
provide () {
return {
userInfo: this.userInfo,
baseConfigData: this.baseConfigData
baseConfigData: this.baseConfigData,
}
},
data () {
......@@ -137,6 +138,7 @@ export default {
position: 'bottom',
chooseContent: null,
componentObject: config.componentConfig,
positionTypeList:[]
}
},
watch: {
......@@ -150,15 +152,20 @@ export default {
},
externalData: {
handler (val) {
if (val) {
}
if (val && val.length && this.componentObject[this.popupType]) {
this.componentObject[this.popupType].cacheData = val
}
},
deep: true,
immediate: true
},
isDefeatOrder: {
async handler (val) {
if (val) {
this.positionTypeList = await uni.$api.popupApi.getPositionList()
}
},
immediate: true
}
},
computed: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!