Commit 2f011c20 by cen

Merge branch 'V4.56.0' of http://192.168.3.233:8090/glsx/gl_tape into V4.56.0

2 parents a301014a 85fcb5e1
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
} }
}) })
let paramsData = dataKey ? data[dataKey] : data let paramsData = dataKey ? data[dataKey] : data
if (paramsData.length) paramsData.map(e => { if (paramsData && paramsData.length) paramsData.map(e => {
this.currentIds.push(e.goods.goodsId) this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e) this.chooseList.push(e)
}) })
......
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
} }
}) })
let paramsData = dataKey ? data[dataKey] : data let paramsData = dataKey ? data[dataKey] : data
if (paramsData.length) paramsData.map(e => { if (paramsData && paramsData.length) paramsData.map(e => {
this.currentIds.push(e.packageGoods.packageCode) this.currentIds.push(e.packageGoods.packageCode)
this.chooseList.push(e) this.chooseList.push(e)
}) })
......
<template>
<uni-popup
ref="popup"
:type="position"
:is-mask-click="maskClick"
:animation="animation"
>
<view :class="['popup-box',{'right-box':position=='right'}]">
<slot></slot>
<view class="popup-footer flex">
<view
class="popup-btn popup-cancel"
@click="cancel"
>取消</view>
<view
class="popup-btn popup-confirm"
@click="confirm"
>确定</view>
</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
props: {
animation: {
type: Boolean,
default: true
},
maskClick: {
type: Boolean,
default: false
},
position:{
type: String,
default: 'bottom'
}
},
data () {
return {
}
},
computed: {
},
mounted () {
},
methods: {
open () {
this.$refs.popup.open()
},
cancel () {
this.$refs.popup.close()
this.$emit('onCancel')
},
close () {
this.$refs.popup.close()
this.$emit('close')
},
confirm () {
this.$emit('onConfirm')
},
}
}
</script>
<style scoped lang='scss'>
.popup-box {
border-radius: 32rpx 32rpx 0 0;
background: #ffffff;
height: 70vh;
.popup-footer {
padding: 64rpx 0;
justify-content: center;
gap: 0 32rpx;
.popup-btn {
display: flex;
align-items: center;
justify-content: center;
width: 720rpx;
height: 80rpx;
border-radius: 64rpx;
background: #f0f1f5;
color: #333333;
font-size: 32rpx;
font-weight: 500;
}
.popup-confirm {
color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
}
}
.right-box {
width: 46vw;
height: 100vh;
border-radius: 32rpx 0 0 32rpx;
.popup-footer {
margin: 0 48rpx;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import NP from 'number-precision'
export default { export default {
name: 'GoodsList', name: 'GoodsList',
inject: ['userInfo', 'baseConfigData'], inject: ['userInfo', 'baseConfigData'],
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
} }
}, },
initGoodsList (goodsData) { initGoodsList (goodsData) {
let { data,dataKey } = this, let { data, dataKey } = this,
arr = [] arr = []
goodsData.map((val) => { goodsData.map((val) => {
if (val.goodsFlag == 1) { if (val.goodsFlag == 1) {
...@@ -163,7 +163,7 @@ export default { ...@@ -163,7 +163,7 @@ export default {
val.active = false val.active = false
val.key = Date.now() val.key = Date.now()
if (val.goodsFlag == 2) { if (val.goodsFlag == 2) {
if(val.multipleSpecificationsGoods?.goods?.sellPrice) val.multipleSpecificationsGoods.goods.sellPrice = null if (val.multipleSpecificationsGoods?.goods?.sellPrice) val.multipleSpecificationsGoods.goods.sellPrice = null
val.multipleSpecificationsGoods.specificationList.forEach(item => { val.multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = '' item.value = ''
item.specificationSelectValueList = [] item.specificationSelectValueList = []
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
} }
}) })
let paramsData = dataKey ? data[dataKey] : data let paramsData = dataKey ? data[dataKey] : data
if (paramsData.length) paramsData.map(e => { if (paramsData && paramsData.length) paramsData.map(e => {
if (e.goodsFlag == 1) { if (e.goodsFlag == 1) {
this.currentIds.push(e.goods.goodsId) this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e) this.chooseList.push(e)
...@@ -269,19 +269,11 @@ export default { ...@@ -269,19 +269,11 @@ export default {
item.specificationStr = item.specificationData.replace(/;~;/g, '/') item.specificationStr = item.specificationData.replace(/;~;/g, '/')
}) })
goodsList[index].multipleSpecificationsGoods.skuGoodsList = goodsArr goodsList[index].multipleSpecificationsGoods.skuGoodsList = goodsArr
let chooseList = await this.getChooseList(false); // let chooseList = await this.getChooseList(false);
this.setData({ // this.$refs.skuPopupRef.open()
show: false, this.$emit('openSkuPopup',goodsList[index])
goodsList
}, () => { this.list = goodsList
let thisPage = wx.$router.getPageInstance();
thisPage.setData({
skuGoodsData: goodsList[index],
skuGoodsBox: true,
goodsList: chooseList
})
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList);
});
} }
} else { } else {
uni.showToast({ uni.showToast({
...@@ -294,6 +286,7 @@ export default { ...@@ -294,6 +286,7 @@ export default {
item.value = '' item.value = ''
}) })
} }
this.list = goodsList
// this.setData({ // this.setData({
// goodsList, // goodsList,
// strTemp: str // strTemp: str
...@@ -308,7 +301,7 @@ export default { ...@@ -308,7 +301,7 @@ export default {
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => { goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = '' item.value = ''
}) })
console.log(33333, goodsList) this.list = goodsList
// this.setData({ // this.setData({
// goodsList // goodsList
// }, () => { // }, () => {
...@@ -320,6 +313,96 @@ export default { ...@@ -320,6 +313,96 @@ export default {
return result return result
}, },
async getChooseList (isValid) {
let {
list: goodsList,
chooseList: chooseGoodsList,
} = this;
let chooseList = [];
goodsList.map((e) => {
if (e.active) {
chooseList.push(e)
}
});
if (isValid) {
if (!chooseList?.length) return uni.showToast({
title: '请勾选商品',
icon: 'none',
})
}
let arr = this.removeDuplicates(
chooseList.concat(chooseGoodsList),
"goodsId"
);
// 太阳膜下单 需保留已选的商品
arr.map(c => {
if (c.active) {
if (c.goods) {
if (!c.count) c.count = 1
c.goods.price = c.goods.sellPrice || 0
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goods && x.goods.goodsId == c.goods.goodsId) {
c.goods.price = x.goods.price || 0
}
})
}
}
if (c.multipleSpecificationsGoods) {
c.isFlag = true //初始化进来不显示标识
if (c.multipleSpecificationsGoods.goods) {
if (!c.count) c.count = 1
c.multipleSpecificationsGoods.goods.price = c.multipleSpecificationsGoods.goods.sellPrice || 0
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2) {
if (x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId) {
c.multipleSpecificationsGoods.goods.price = x.multipleSpecificationsGoods.goods.price || 0
}
}
})
}
}
}
}
})
return arr;
},
removeDuplicates (arr, property) {
var uniqueArray = [];
for (var i = 0; i < arr.length; i++) {
let goodsType = arr[i].goodsFlag == 1 ? 'goods' : 'multipleSpecificationsGoods.goods'
let value = this.circulation(arr[i], goodsType)[property]
// 兼容套餐
let result = uniqueArray.some(item => {
let key = item.goodsFlag == 1 ? 'goods' : item.goodsFlag == 2 ? 'multipleSpecificationsGoods.goods' : ''
let deepValue = this.circulation(item, key)
return deepValue ? deepValue[property] === value : false
})
if (!result) {
uniqueArray.push(arr[i]);
}
}
return uniqueArray;
},
circulation (data, str) {
if (str) {
let arr = str.split('.'),
result;
if (arr.length) {
result = arr.reduce((pre, key) => {
return pre[key] ? pre[key] : {}
}, data)
}
return result;
} else {
return false
}
},
} }
} }
</script> </script>
......
<template>
<popup
ref="popup"
@onConfirm="confirm"
@onCancel="cancel"
>
<view class="popup-title flex">
确认需购买的商品
<view
class="popup-close flex"
@click="close"
>
<uni-icons
type="closeempty"
size="16"
></uni-icons>
</view>
</view>
<view class="popup-tips">温馨提示:请仔细确认当前售价,避免录错单</view>
<template v-if="data">
<view class="popup-body">
<scroll-view
scroll-y
class="popup-scroll-view"
>
<view class="goods-list">
<template v-for="(i, index) in data.multipleSpecificationsGoods.skuGoodsList">
<view
:key="index"
@click="choose(i)"
:class="['item flex',{active: i.goodsId == currentId }]"
>
<view class="sprite-icon icon-tag-checked"></view>
<view class="text">
<view class="name"> {{data.multipleSpecificationsGoods.baseGoodsName}}</view>
<view
class="alias"
v-if="i.goodsAlias"
>
商品别名:{{i.goodsAlias}}
</view>
<view
class="position"
v-if="i.specificationStr "
>{{i.specificationStr}}</view>
</view>
<view class="price">¥<text class="price-num">{{i.sellPrice}}</text>x1</view>
</view>
</template>
</view>
</scroll-view>
</view>
</template>
</popup>
</template>
<script type='text/ecmascript-6'>
import Popup from './Popup.vue'
export default {
components: {
Popup,
},
name: '',
props: {
},
data () {
return {
data: null,
currentId: ''
}
},
mounted () {
},
methods: {
open (data) {
this.data = data
this.$nextTick(() => {
this.$refs.popup.open()
})
},
cancel () {
this.$refs.popup.close()
this.$emit('cancel')
},
close () {
this.$refs.popup.close()
this.$emit('close')
},
choose (i) {
let { currentId } = this
if (currentId == i.goodsId) {
this.currentId = ''
return
}
this.currentId = i.goodsId
},
confirm () {
let { currentId, data } = this
if (!currentId || !data) return uni.showToast({
title: '请勾选商品',
})
let { baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList } = data.multipleSpecificationsGoods
let goods = skuGoodsList.find(e => e.goodsId == currentId)
this.$emit('onConfirm', {
count: 1,
goods: null,
goodsFlag: 2,
isFlag: true,
multipleSpecificationsGoods: {
baseGoodsName,
id,
specificationGoodsMap,
specificationList,
goods
}
})
this.close()
},
}
}
</script>
<style scoped lang='scss'>
.popup-box {
border-radius: 32rpx 32rpx 0 0;
background: #ffffff;
height: 70vh;
.popup-title {
height: 104rpx;
justify-content: center;
position: relative;
color: #333333;
font-size: 36rpx;
font-weight: 500;
.popup-close {
position: absolute;
height: 100%;
top: 0;
right: 0;
padding: 0 48rpx;
font-weight: 400;
color: #1a1a1a;
}
}
.popup-tips {
color: #999ea8;
font-size: 28rpx;
padding-left: 48rpx;
}
.popup-body {
height: calc(100% - 350rpx);
.popup-scroll-view {
height: 100%;
padding-top: 24rpx;
.goods-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 32rpx;
margin: 0 48rpx;
.item {
height: 176rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
box-sizing: border-box;
padding: 0 32rpx;
background: #f5f7fa;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
.text {
color: #666666;
font-size: 24rpx;
line-height: 36rpx;
.name {
color: #333333;
font-size: 28rpx;
font-weight: 500;
margin-bottom: 8rpx;
line-height: 40rpx;
}
.alias {
margin-bottom: 8rpx;
}
}
.price {
margin-left: auto;
color: #333333;
font-size: 28rpx;
font-weight: 500;
&-num {
margin-right: 16rpx;
}
}
}
.active {
border-color: #4673ff;
background: #4673ff1a;
.sprite-icon {
display: block;
}
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<uni-popup <view class="order-popup">
ref="popup" <popup
:type="position" :position="position"
:is-mask-click="maskClick"
:animation="animation" :animation="animation"
ref="popup"
@onConfirm="confirm"
@onCancel="cancel"
> >
<view :class="['popup-box',{'right-box':position=='right'}]">
<view class="popup-title flex"> <view class="popup-title flex">
{{title}} {{title}}
<view <view
...@@ -53,26 +54,21 @@ ...@@ -53,26 +54,21 @@
:dataKey="dataKey" :dataKey="dataKey"
ref="componentRef" ref="componentRef"
@choose="chooseContent = $event" @choose="chooseContent = $event"
@openSkuPopup="openSkuPopup"
></component> ></component>
</scroll-view> </scroll-view>
</view> </view>
<view class="popup-footer flex"> </popup>
<view <sku-popup
class="popup-btn popup-cancel" ref="skuPopupRef"
@click="cancel" @onConfirm="skuConfirm"
>取消</view> ></sku-popup>
<view
class="popup-btn popup-confirm"
@click="confirm"
>确定</view>
</view>
</view> </view>
</uni-popup>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Popup from './components/Popup.vue'
import config from './config' import config from './config'
import EmployeeList from './components/EmployeeList.vue' import EmployeeList from './components/EmployeeList.vue'
import DiversionMerchant from './components/DiversionMerchant.vue' import DiversionMerchant from './components/DiversionMerchant.vue'
...@@ -81,15 +77,18 @@ import CouponList from './components/CouponList.vue' ...@@ -81,15 +77,18 @@ import CouponList from './components/CouponList.vue'
import GoodsList from './components/GoodsList.vue' import GoodsList from './components/GoodsList.vue'
import PackageList from './components/PackageList.vue' import PackageList from './components/PackageList.vue'
import SkuGoodsList from './components/SkuGoodsList.vue' import SkuGoodsList from './components/SkuGoodsList.vue'
import SkuPopup from './components/SkuPopup.vue'
export default { export default {
components: { components: {
Popup,
EmployeeList, EmployeeList,
DiversionMerchant, DiversionMerchant,
CarModelList, CarModelList,
CouponList, CouponList,
GoodsList, GoodsList,
PackageList, PackageList,
SkuGoodsList SkuGoodsList,
SkuPopup
}, },
name: '', name: '',
props: { props: {
...@@ -192,6 +191,16 @@ export default { ...@@ -192,6 +191,16 @@ export default {
this.$refs.popup.close() this.$refs.popup.close()
} }
}, },
openSkuPopup (data) {
this.confirm()
this.$refs.skuPopupRef.open(data)
},
skuConfirm (e) {
this.$emit('onConfirm', {
chooseContent: [e],
popupType: 12
})
},
clear () { clear () {
this.componentObject.searchValue = '' this.componentObject.searchValue = ''
this.handleSearch() this.handleSearch()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!