Commit f4a6a42d by cen

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

2 parents d0922c80 ecbbe88b
...@@ -228,6 +228,14 @@ module.exports = { ...@@ -228,6 +228,14 @@ module.exports = {
getServiceBaseInfo(data) { getServiceBaseInfo(data) {
return http.post({ method: 'dj.api.smartcarlife.serviceMerchant.getServiceBaseInfo', projectName: 'boutique', ...data }) return http.post({ method: 'dj.api.smartcarlife.serviceMerchant.getServiceBaseInfo', projectName: 'boutique', ...data })
}, },
/** 获取转化员上一笔订单的销售顾问 */
getLastUserOrderInfo(data) {
return http.post({
method: 'dj.api.smartcarlife.order.getLastUser',
projectName: 'boutique',
...data
})
},
/**根据订单号获取订单详情(含套餐) */ /**根据订单号获取订单详情(含套餐) */
getPackageGoodsDetail(data) { getPackageGoodsDetail(data) {
return http.post({ method: 'dj.api.smartcarlife.order.packageGoodsDetail', projectName: 'boutique', ...data }) return http.post({ method: 'dj.api.smartcarlife.order.packageGoodsDetail', projectName: 'boutique', ...data })
......

2.56 MB | W: | H:

2.55 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -25,11 +25,14 @@ ...@@ -25,11 +25,14 @@
:class="[ :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]} {active: (currentId ? j.id == currentId : j.id == data.customer[params.idKey]) && !j.isTitle}
]" ]"
@click="choose(j,c)" @click="choose(j,c)"
> >
<view class="sprite-icon icon-tag-checked" v-if="!j.isTitle"></view> <view
class="sprite-icon icon-tag-checked"
v-if="!j.isTitle"
></view>
{{j.name}} {{j.name}}
</view> </view>
</template> </template>
...@@ -132,7 +135,7 @@ export default { ...@@ -132,7 +135,7 @@ export default {
} }
}) })
this.list = carModelList this.list = carModelList
this.$emit('onComplete')
}, },
handleSearch (searchValue) { handleSearch (searchValue) {
if (!searchValue) { if (!searchValue) {
......
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
list, list,
}; };
}) })
this.$emit('onComplete')
this.list = couponList this.list = couponList
}, },
async getCustomerCouponList (customerPhone) { async getCustomerCouponList (customerPhone) {
......
<template>
<view class="date-list">
<picker-view
class="picker picker_max"
:value="dateValues"
indicator-class="indicator"
@change="changeDate"
>
<picker-view-column>
<template v-for="(item,index) in days">
<view
class="view"
:key="index"
>{{item}}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view
class="picker"
:value="hourValues"
indicator-class="indicator"
@change="changeHour"
>
<picker-view-column>
<template v-for="(item,index) in hours">
<view
class="view"
:key="index"
>{{item}}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view
class="picker"
:value="minuteValues"
indicator-class="indicator"
@change="changeMinutes"
>
<picker-view-column>
<template v-for="(item,index) in minutes">
<view
class="view"
:key="index"
>{{item}}</view>
</template>
</picker-view-column>
</picker-view>
</view>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs'
export default {
name: 'DateTime',
inject: ['userInfo'],
data () {
return {
hours: [],
days: [],
minutes: [],
dateValues: [],
hourValues: [],
minuteValues: [],
loading: true
}
},
props: {
},
mounted () {
this.initDate()
},
methods: {
initDate () {
this.dateValues = []
this.hourValues = []
this.minuteValues = []
const today = new Date()
this.getDateList('2019/01/01', new Date(today.getFullYear(), today.getMonth(), today.getDate()))
},
getDateList (starDay, endDay) {
const arr = [];
const dates = [];
// 设置两个日期UTC时间
const db = new Date(starDay);
const de = new Date(endDay);
// 获取两个日期GTM时间
const s = db.getTime() - 24 * 60 * 60 * 1000;
const d = de.getTime() - 24 * 60 * 60 * 1000;
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d;) {
i = i + 24 * 60 * 60 * 1000;
arr.push(parseInt(String(i)));
}
// 获取每一天的时间 YY-MM-DD
for (const j in arr) {
const time = new Date(arr[j]);
const year = time.getFullYear();
const mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
const day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
const YYMMDD = year + '/' + mouth + '/' + day;
dates.push(YYMMDD);
}
this.getHourList(dates)
},
getHourList (days) {
const hours = [], today = new Date();
for (let hour = 0; hour < today.getHours() + 1; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
this.getMinuteList(days, hours)
},
getMinuteList (days, hours) {
const minutes = [];
const today = new Date()
for (let minute = 0; minute < today.getMinutes() + 1; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
// 设置默认时间
let { dateValues, hourValues, minuteValues } = this
const HOUR_STR = today.getHours().toString().padStart(2, '0')
const MUNTUE_STR = today.getMinutes().toString().padStart(2, '0')
// const defalutHIndex = hours.indexOf(HOUR_STR)
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
dateValues.push(days.length + 1)
hourValues.push(hours.length + 1)
minuteValues.push(minutes.length + 1)
this.currentDate = dayjs().format('YYYY/MM/DD')
this.currentHour = HOUR_STR
this.currentMinute = MUNTUE_STR
this.hours = hours
this.days = days
this.minutes = minutes
this.dateValues = dateValues
this.hourValues = hourValues
this.minuteValues = minuteValues
this.loading = false
setTimeout(() => {
this.minuteValues = minuteValues
this.loading = false
}, 100)
},
changeDate (e) {
const { days } = this
const { value } = e.detail
const index = value[0]
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
changeHour (e) {
const { hours, days, dateValues } = this
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
changeMinutes (e) {
const { minutes } = this
const { value } = e.detail
const index = value[0]
this.currentMinute = minutes[index]
},
getAllTimeOrPartTime (type) {
const today = new Date()
const hours = [], minutes = [], hour_len = type == 1 ? 24 : today.getHours() + 1, minute_len = type == 1 ? 60 : today.getMinutes() + 1;
for (let hour = 0; hour < hour_len; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.hours = hours
this.minutes = minutes
},
getAllTimeOrPartTimeMinute (type) {
const today = new Date()
const currentHour = today.getHours()
const timeType = this.currentHour != currentHour ? 1 : 0
const minutes = [], minute_len = type == 1 || timeType == 1 ? 60 : today.getMinutes() + 1;
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.minutes = minutes
},
getResult () {
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute + ":00"
const result = dayjs(str).format('YYYY/MM/DD HH:mm:ss')
return result
}
}
}
</script>
<style scoped lang='scss'>
.date-list {
height: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
.picker {
height: 100%;
text-align: center;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
{ cacheData } = params { cacheData } = params
this.currentId = '' this.currentId = ''
if (cacheData && cacheData.length) { if (cacheData && cacheData.length) {
this.$emit('onComplete')
this.list = cacheData this.list = cacheData
return return
} }
...@@ -42,6 +43,7 @@ export default { ...@@ -42,6 +43,7 @@ export default {
merchantId: shopMerchantId merchantId: shopMerchantId
}) })
if (data && data.length) { if (data && data.length) {
this.$emit('onComplete')
this.list = data this.list = data
params.cacheData = data params.cacheData = data
this.$emit('update:params', params) this.$emit('update:params', params)
......
...@@ -36,6 +36,7 @@ export default { ...@@ -36,6 +36,7 @@ export default {
{ cacheData } = params { cacheData } = params
this.currentId = '' this.currentId = ''
if (!search && cacheData && cacheData.length) { if (!search && cacheData && cacheData.length) {
this.$emit('onComplete')
this.list = cacheData this.list = cacheData
return return
} }
...@@ -46,6 +47,7 @@ export default { ...@@ -46,6 +47,7 @@ export default {
name: searchValue name: searchValue
}) })
if (data && data.length) { if (data && data.length) {
this.$emit('onComplete')
this.list = data this.list = data
params.cacheData = data params.cacheData = data
this.$emit('update:params', params) this.$emit('update:params', params)
......
...@@ -100,6 +100,7 @@ export default { ...@@ -100,6 +100,7 @@ export default {
this.currentIds.push(e.goods.goodsId) this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e) this.chooseList.push(e)
}) })
this.$emit('onComplete')
return arr return arr
}, },
choose (i) { choose (i) {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import NP from 'number-precision' import NP from 'number-precision'
export default { export default {
name: 'GoodsList', name: 'PackageList',
inject: ['userInfo', 'baseConfigData'], inject: ['userInfo', 'baseConfigData'],
data () { data () {
return { return {
...@@ -115,6 +115,7 @@ export default { ...@@ -115,6 +115,7 @@ export default {
this.currentIds.push(e.packageGoods.packageCode) this.currentIds.push(e.packageGoods.packageCode)
this.chooseList.push(e) this.chooseList.push(e)
}) })
this.$emit('onComplete')
return arr return arr
}, },
choose (i) { choose (i) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: '', name: 'Popup',
props: { props: {
animation: { animation: {
type: Boolean, type: Boolean,
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: 'GoodsList', name: 'SkuGoodsList',
inject: ['userInfo', 'baseConfigData'], inject: ['userInfo', 'baseConfigData'],
data () { data () {
return { return {
...@@ -184,6 +184,7 @@ export default { ...@@ -184,6 +184,7 @@ export default {
this.chooseList.push(e) this.chooseList.push(e)
} }
}) })
this.$emit('onComplete')
return arr return arr
}, },
async choose (i, index) { async choose (i, index) {
...@@ -259,6 +260,8 @@ export default { ...@@ -259,6 +260,8 @@ export default {
goodsList[index].multipleSpecificationsGoods.goods = goodsArr[0] goodsList[index].multipleSpecificationsGoods.goods = goodsArr[0]
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/') goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/')
this.chooseList.push(goodsList[index])
this.$emit('choose', this.chooseList)
} else { } else {
//多个多规格商品时出现弹窗 //多个多规格商品时出现弹窗
goodsList[index].active = false goodsList[index].active = false
...@@ -271,7 +274,7 @@ export default { ...@@ -271,7 +274,7 @@ export default {
goodsList[index].multipleSpecificationsGoods.skuGoodsList = goodsArr goodsList[index].multipleSpecificationsGoods.skuGoodsList = goodsArr
// let chooseList = await this.getChooseList(false); // let chooseList = await this.getChooseList(false);
// this.$refs.skuPopupRef.open() // this.$refs.skuPopupRef.open()
this.$emit('openSkuPopup',goodsList[index]) this.$emit('openSkuPopup', goodsList[index])
this.list = goodsList this.list = goodsList
} }
...@@ -301,6 +304,12 @@ export default { ...@@ -301,6 +304,12 @@ export default {
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => { goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = '' item.value = ''
}) })
let { chooseList } = this
chooseList.forEach((item, ind) => {
if (item.multipleSpecificationsGoods.id === goodsList[index].multipleSpecificationsGoods.id) {
chooseList.splice(ind, 1)
}
})
this.list = goodsList this.list = goodsList
// this.setData({ // this.setData({
// goodsList // goodsList
......
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
components: { components: {
Popup, Popup,
}, },
name: '', name: 'SkuPopup',
props: { props: {
}, },
......
...@@ -27,6 +27,7 @@ const componentConfig = { ...@@ -27,6 +27,7 @@ const componentConfig = {
name: 'EmployeeList', name: 'EmployeeList',
title: '交付专员', title: '交付专员',
placeholder: '请输入姓名', placeholder: '请输入姓名',
nullTips: '请选择交付专员',
idKey: 'deliveryUserId' idKey: 'deliveryUserId'
}, },
2: { 2: {
...@@ -51,13 +52,15 @@ const componentConfig = { ...@@ -51,13 +52,15 @@ const componentConfig = {
name: 'CouponList', name: 'CouponList',
title: '选择礼券', title: '选择礼券',
placeholder: '查找', placeholder: '查找',
idKey: 'customerCouponCode' idKey: 'customerCouponCode',
nullTips: '优惠券不能为空'
}, },
6: { 6: {
name: 'GoodsList', name: 'GoodsList',
title: '选择商品(可多选)', title: '选择商品(可多选)',
placeholder: '请输入名称', placeholder: '请输入名称',
idKey: 'goodsId', idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [1]//前档 goodsType: [1]//前档
}, },
7: { 7: {
...@@ -65,13 +68,15 @@ const componentConfig = { ...@@ -65,13 +68,15 @@ const componentConfig = {
title: '选择商品(可多选)', title: '选择商品(可多选)',
placeholder: '请输入名称', placeholder: '请输入名称',
idKey: 'goodsId', idKey: 'goodsId',
goodsType:[2] // 前侧窗玻璃 nullTips: '请勾选商品',
goodsType: [2] // 前侧窗玻璃
}, },
8: { 8: {
name: 'GoodsList', name: 'GoodsList',
title: '选择商品(可多选)', title: '选择商品(可多选)',
placeholder: '请输入名称', placeholder: '请输入名称',
idKey: 'goodsId', idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [3] // 后侧窗玻璃 goodsType: [3] // 后侧窗玻璃
}, },
9: { 9: {
...@@ -79,6 +84,7 @@ const componentConfig = { ...@@ -79,6 +84,7 @@ const componentConfig = {
title: '选择商品(可多选)', title: '选择商品(可多选)',
placeholder: '请输入名称', placeholder: '请输入名称',
idKey: 'goodsId', idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [4] // 后档 goodsType: [4] // 后档
}, },
10: { 10: {
...@@ -86,19 +92,27 @@ const componentConfig = { ...@@ -86,19 +92,27 @@ const componentConfig = {
title: '选择商品(可多选)', title: '选择商品(可多选)',
placeholder: '请输入名称', placeholder: '请输入名称',
idKey: 'goodsId', idKey: 'goodsId',
goodsType:[5, 6, 7] // 天窗 nullTips: '请勾选商品',
goodsType: [5, 6, 7] // 天窗
}, },
11:{ 11: {
name: 'PackageList', name: 'PackageList',
title: '选择套餐', title: '选择套餐',
placeholder:'查找', placeholder: '查找',
nullTips: '请勾选套餐',
idKey: 'packageCode' idKey: 'packageCode'
}, },
12:{ 12: {
name:'SkuGoodsList', name: 'SkuGoodsList',
title: '选择商品', title: '选择商品',
placeholder:'查找', nullTips: '请勾选商品',
placeholder: '查找',
},
13: {
name: 'DateTime',
title: '选择时间',
hideSearch: true,
} }
} }
export default { componentConfig}
\ No newline at end of file \ No newline at end of file
export default { componentConfig }
\ No newline at end of file \ No newline at end of file
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<view :class="['popup-body',{ 'hide-search' :componentObject.hideSearch}]"> <view :class="['popup-body',{ 'hide-search' :componentObject.hideSearch}]">
<scroll-view <scroll-view
scroll-y scroll-y
class="popup-scroll-view" :class="['popup-scroll-view',{show:loadComplete}]"
> >
<component <component
:is="componentObject.name" :is="componentObject.name"
...@@ -55,9 +55,14 @@ ...@@ -55,9 +55,14 @@
ref="componentRef" ref="componentRef"
@choose="chooseContent = $event" @choose="chooseContent = $event"
@openSkuPopup="openSkuPopup" @openSkuPopup="openSkuPopup"
@onComplete="loadComplete = true"
></component> ></component>
</scroll-view> </scroll-view>
<image
v-if="!loadComplete"
class="loading"
src="../../assets/images/common/loadding.gif"
/>
</view> </view>
</popup> </popup>
<sku-popup <sku-popup
...@@ -78,6 +83,7 @@ import GoodsList from './components/GoodsList.vue' ...@@ -78,6 +83,7 @@ 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' import SkuPopup from './components/SkuPopup.vue'
import DateTime from './components/DateTime.vue'
export default { export default {
components: { components: {
Popup, Popup,
...@@ -88,7 +94,8 @@ export default { ...@@ -88,7 +94,8 @@ export default {
GoodsList, GoodsList,
PackageList, PackageList,
SkuGoodsList, SkuGoodsList,
SkuPopup SkuPopup,
DateTime
}, },
name: '', name: '',
props: { props: {
...@@ -121,6 +128,7 @@ export default { ...@@ -121,6 +128,7 @@ export default {
position: 'bottom', position: 'bottom',
chooseContent: null, chooseContent: null,
componentObject: null, componentObject: null,
loadComplete: false
} }
}, },
watch: { watch: {
...@@ -128,6 +136,7 @@ export default { ...@@ -128,6 +136,7 @@ export default {
handler (val) { handler (val) {
this.componentObject = config.componentConfig[this.popupType] this.componentObject = config.componentConfig[this.popupType]
if (val == 11 || val == 12) this.position = 'right' if (val == 11 || val == 12) this.position = 'right'
else this.position = 'bottom'
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -182,13 +191,26 @@ export default { ...@@ -182,13 +191,26 @@ export default {
else componentRef.handleSearch(this.componentObject.searchValue) else componentRef.handleSearch(this.componentObject.searchValue)
}, },
confirm () { confirm () {
let { chooseContent, popupType } = this try {
let { chooseContent, popupType, componentObject } = this
if (popupType === 13) {
chooseContent = this.componentRef().getResult()
}
if (chooseContent) { if (chooseContent) {
if(Array.isArray(chooseContent) && !chooseContent.length && componentObject.nullTips) throw componentObject.nullTips
this.$emit('onConfirm', { this.$emit('onConfirm', {
chooseContent, chooseContent,
popupType popupType
}) })
this.$refs.popup.close() this.$refs.popup.close()
} else {
if (componentObject.nullTips) throw componentObject.nullTips
}
} catch (error) {
uni.showToast({
title: error,
icon: 'none'
})
} }
}, },
openSkuPopup (data) { openSkuPopup (data) {
...@@ -271,9 +293,22 @@ export default { ...@@ -271,9 +293,22 @@ export default {
} }
.popup-body { .popup-body {
height: calc(100% - 392rpx); height: calc(100% - 392rpx);
position: relative;
.popup-scroll-view { .popup-scroll-view {
height: 100%; height: 100%;
padding-top: 32rpx; padding-top: 32rpx;
opacity: 0;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: toRpx(64);
height: toRpx(64);
}
.show {
opacity: 1;
} }
} }
.hide-search { .hide-search {
......
...@@ -4,13 +4,28 @@ ...@@ -4,13 +4,28 @@
<view class="box"> <view class="box">
<scroll-view class="scroll-view" scroll-y="true"> <scroll-view class="scroll-view" scroll-y="true">
<view class="box-content"> <view class="box-content">
<GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" @handleCell="handleCell"> <GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur"
<template slot="frontGear"> @handleCell="handleCell">
<Product v-if="orderObj.frontGear && orderObj.frontGear.length" :list="orderObj.frontGear" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product> <!-- 使用v-for循环渲染产品组件,减少重复代码 -->
<template v-for="(_, slotName) in productSlots" :slot="slotName" >
<Product
:key="slotName"
v-if="orderObj[slotName] && orderObj[slotName].length"
@changeTotalPrice="changeTotalPrice"
:list="orderObj[slotName]"
:positionTypeList="positionTypeList"
:baseConfigData="baseConfigData">
</Product>
</template> </template>
<template slot="package"> <template slot="package">
<Package></Package> <Package></Package>
</template> </template>
<template slot="skuGoods">
<view class="total" v-if="totalPrice > 0">
<view class="total-left">总价</view>
<view class="total-right">¥{{totalPrice}}</view>
</view>
</template>
<template slot="otherPay"> <template slot="otherPay">
<view v-if="showPayTips" class="pay-tips">其他收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其他收款」。</view> <view v-if="showPayTips" class="pay-tips">其他收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其他收款」。</view>
</template> </template>
...@@ -50,6 +65,9 @@ export default { ...@@ -50,6 +65,9 @@ export default {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
console.log('接收到的交易数据:', newVal) console.log('接收到的交易数据:', newVal)
this.orderCreateType = 'supplementOrder'
this.orderObj.outTradeNo = newVal.selectedItems.map(item => item.outTradeNo).join(',')
this.orderObj.tradeNo = newVal.selectedItems.map(item => item.tradeNo).join(',')
} }
}, },
immediate: true immediate: true
...@@ -57,6 +75,7 @@ export default { ...@@ -57,6 +75,7 @@ export default {
}, },
data() { data() {
return { return {
orderCreateType: "createWithPay", // supplementOrder(补录订单) createWithPay(新增)
formList: utils.deepClone(FORM_LIST), formList: utils.deepClone(FORM_LIST),
userInfo: {}, userInfo: {},
baseConfigData: {}, baseConfigData: {},
...@@ -67,7 +86,11 @@ export default { ...@@ -67,7 +86,11 @@ export default {
experienceFlag: 'Y', experienceFlag: 'Y',
payeeType: 1, payeeType: 1,
salesType: '0', salesType: '0',
frontGear: null frontGear: null,
frontWindow: null,
rearWindow: null,
rearGear: null,
sunRoof: null,
}, // 弹窗传入的数据}, }, // 弹窗传入的数据},
popupType: 0, popupType: 0,
popupTypeEnum, popupTypeEnum,
...@@ -80,7 +103,16 @@ export default { ...@@ -80,7 +103,16 @@ export default {
payTypeList, payTypeList,
goodsList: [], goodsList: [],
positionTypeList: [], positionTypeList: [],
valueKey: '' valueKey: '',
totalPrice: 0,
// 产品槽位配置,用于循环渲染产品组件
productSlots: {
frontGear: true,
frontWindow: true,
rearGear: true,
rearWindow: true,
sunRoof: true
},
} }
}, },
computed: { computed: {
...@@ -93,7 +125,7 @@ export default { ...@@ -93,7 +125,7 @@ export default {
console.log(options, 'options') console.log(options, 'options')
}, },
mounted() { mounted() {
console.log('mounted') console.log('mounted', this.orderCreateType)
this.userInfo = uni.$storage.get('userInfo') || {} this.userInfo = uni.$storage.get('userInfo') || {}
this.baseConfigData = uni.$storage.get('mock_data') || {} this.baseConfigData = uni.$storage.get('mock_data') || {}
const { userInfo } = this const { userInfo } = this
...@@ -115,9 +147,10 @@ export default { ...@@ -115,9 +147,10 @@ export default {
this.getSubShopMerchantList(userInfo.shopMerchantId) this.getSubShopMerchantList(userInfo.shopMerchantId)
this.getSetting() this.getSetting()
this.getConfig() this.getConfig()
this.getEmployeeList() // this.getEmployeeList()
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
this.getPositionList() this.getPositionList()
if (this.orderCreateType == 'createWithPay') this.getLastUserOrderInfo() // 补录订单不需要设置默认值
}, },
// 选择行事件 // 选择行事件
handleCell(val) { handleCell(val) {
...@@ -147,12 +180,15 @@ export default { ...@@ -147,12 +180,15 @@ export default {
this.changePayee() this.changePayee()
} }
}, },
// 弹窗确认回调
onConfirm(val) { onConfirm(val) {
console.log(val, 'onConfirm') console.log(val, 'onConfirm')
const { chooseContent } = val const { chooseContent } = val
// 根据popupTypeEnum优化处理 // 根据popupTypeEnum优化处理
const _typeValue = this.popupTypeEnum[this.popupType] const _typeValue = this.popupTypeEnum[this.popupType]
console.log(_typeValue) console.log(_typeValue)
// 定义产品相关字段数组
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof'];
if (_typeValue.key == 'carBrand') { if (_typeValue.key == 'carBrand') {
// 车型 // 车型
this.$set(this.orderObj, _typeValue.key, `${chooseContent.carBrand}-${chooseContent.carChildsBrandName}-${chooseContent.carSeriesName}`) this.$set(this.orderObj, _typeValue.key, `${chooseContent.carBrand}-${chooseContent.carChildsBrandName}-${chooseContent.carSeriesName}`)
...@@ -169,10 +205,14 @@ export default { ...@@ -169,10 +205,14 @@ export default {
customerCouponCode: customerCouponCode customerCouponCode: customerCouponCode
}) })
this.$set(this.orderObj, 'couponInfo', couponName + customerCouponCode) this.$set(this.orderObj, 'couponInfo', couponName + customerCouponCode)
} else if (_typeValue.key == 'frontGear') { } else if (productFields.includes(_typeValue.key)) {
this.$set(this.orderObj, 'frontGear', val.chooseContent) // 商品类,需计算总价
this.$set(this.orderObj, _typeValue.key, val.chooseContent)
this.$nextTick(() => {
// 确保数据更新后再计算总价
this.changeTotalPrice()
})
} else if (_typeValue.key) { } else if (_typeValue.key) {
// this.formObj[_typeValue.key] = chooseContent;
this.orderObj[_typeValue.targetIdKey] = chooseContent[_typeValue.sourceIdKey] this.orderObj[_typeValue.targetIdKey] = chooseContent[_typeValue.sourceIdKey]
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey]) this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey])
} }
...@@ -254,6 +294,7 @@ export default { ...@@ -254,6 +294,7 @@ export default {
async submit() { async submit() {
console.log(this.orderObj) console.log(this.orderObj)
if (!this.checkRequired()) return if (!this.checkRequired()) return
const {orderCreateType} = this
const obj = utils.deepClone(this.orderObj) const obj = utils.deepClone(this.orderObj)
const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType'] const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType']
obj.customer = { obj.customer = {
...@@ -266,8 +307,17 @@ export default { ...@@ -266,8 +307,17 @@ export default {
return acc return acc
}, {}) }, {})
} }
if (obj.frontGear) { // 将 frontGear、frontWindow、rearGear、rearWindow、sunRoof 字段合并到 goodsList 中
obj.subOrderList = obj.frontGear.map(item => { const labelFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']
let goodsList = []
labelFields.forEach(field => {
if (Array.isArray(obj[field]) && obj[field].length > 0) {
goodsList = goodsList.concat(obj[field]);
}
delete obj[field];
});
if (goodsList.length > 0) {
obj.subOrderList = goodsList.map(item => {
return { return {
totalPrice: item.goods.sellPrice, totalPrice: item.goods.sellPrice,
number: item.goods.number, number: item.goods.number,
...@@ -275,11 +325,10 @@ export default { ...@@ -275,11 +325,10 @@ export default {
} }
}) })
} }
delete obj.frontGear
delete obj.carBrand delete obj.carBrand
delete obj.couponInfo delete obj.couponInfo
console.log(obj, 'rucan') console.log(obj, 'rucan')
const res = await uni.$api.boutiqueApi.createWithPay(obj) const res = await uni.$api.boutiqueApi[orderCreateType](obj)
console.log(res, '===submit') console.log(res, '===submit')
if (res) { if (res) {
uni.showToast({ uni.showToast({
...@@ -289,6 +338,35 @@ export default { ...@@ -289,6 +338,35 @@ export default {
this.$emit('jump', 'ConfirmOrder', res.data) this.$emit('jump', 'ConfirmOrder', res.data)
} }
}, },
// 计算所有产品的总价
changeTotalPrice() {
let total = 0
// 遍历所有产品槽位
Object.keys(this.productSlots).forEach(slotName => {
const productList = this.orderObj[slotName]
if (Array.isArray(productList) && productList.length > 0) {
// 计算每个产品的价格 * 数量,并累加到总价
productList.forEach(item => {
if (item.goods && item.goods.sellPrice && item.goods.number) {
total += parseFloat(item.goods.sellPrice) * parseInt(item.goods.number)
}
})
}
})
console.log(total, 'total')
// 更新总价
this.totalPrice = total.toFixed(2)
},
// 获取上一个订单的销售顾问信息 并且不是再次下单
async getLastUserOrderInfo() {
const res = await uni.$api.boutiqueApi.getLastUserOrderInfo({
sellerUserId: this.userInfo.subLoginUser.uuid
})
this.$set(this.orderObj, 'employeeName', res.employeeName)
this.orderObj.userId = res.userId
console.log(res, '上一个订单的销售顾问信息')
},
async getShopMerchantPointConfig(merchantId) { async getShopMerchantPointConfig(merchantId) {
const res = await uni.$api.boutiqueApi.getShopMerchantPointConfig({ merchantId }) const res = await uni.$api.boutiqueApi.getShopMerchantPointConfig({ merchantId })
console.log(res) console.log(res)
...@@ -392,8 +470,8 @@ export default { ...@@ -392,8 +470,8 @@ export default {
}) })
if (data && data.length) { if (data && data.length) {
this.employeeList = data this.employeeList = data
this.$set(this.orderObj, 'employeeName', data[0].staffName) // this.$set(this.orderObj, 'employeeName', data[0].staffName)
this.orderObj.userId = data[0].uuid // this.orderObj.userId = data[0].uuid
} }
}, },
async getPositionList() { async getPositionList() {
...@@ -628,6 +706,25 @@ export default { ...@@ -628,6 +706,25 @@ export default {
} }
} }
.total {
display: flex;
justify-content: space-between;
align-items: center;
padding: toRpx(24) toRpx(32) toRpx(24) 0;
font-size: toRpx(28);
border-bottom: toRpx(2) solid #f7f7f6;
&-left {
color: #333;
font-weight: 500;
}
&-right {
color: #f45001;
font-weight: 500;
}
}
.pay-tips { .pay-tips {
padding: toRpx(24) toRpx(24) toRpx(24) 0; padding: toRpx(24) toRpx(24) toRpx(24) 0;
font-size: toRpx(24); font-size: toRpx(24);
......
<template>
<uni-popup ref="popup" type="center" border-radius="16px" :mask-click="false">
<view class="popup-content" :class="[`popup-${type}`]">
<view class="popup-icon">
<image
:src="require(`../../../../assets/images/common/${type}-notice.png`)"
mode="aspectFit"
class="icon-image"
/>
</view>
<view class="popup-title">{{ title }}</view>
<view class="popup-text">{{ text }}</view>
<view class="popup-buttons">
<view
v-for="(button, index) in buttons"
:key="index"
class="popup-button"
:class="[
`button-${button.type || 'default'}`,
{ 'single-button': buttons.length === 1 }
]"
@click="handleButtonClick(button)"
>
{{ button.text }}
</view>
</view>
</view>
</uni-popup>
</template>
<script>
export default {
props: {
// 弹窗类型:success, error, warning, info
type: {
type: String,
default: 'info'
},
// 弹窗标题
title: {
type: String,
default: '提示'
},
// 弹窗内容
text: {
type: String,
default: ''
},
// 按钮配置
buttons: {
type: Array,
default: () => [{
text: '确认',
type: 'primary',
callback: null
}]
}
},
data() {
return {
popupShow: false
}
},
computed: {
// 根据类型返回对应的图标
iconSrc() {
const iconMap = {
success: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-success.png',
error: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-error.png',
warning: '@/assets/images/common/warning-notice.png',
info: 'https://img01.glsx.com.cn/weapp/resource/app-tape/media/common/icon-info.png'
}
return iconMap[this.type] || iconMap.info
}
},
methods: {
open() {
this.$refs.popup.open("center");
},
close() {
this.$refs.popup.close()
},
// 处理按钮点击事件
handleButtonClick(button) {
if (typeof button.callback === 'function') {
button.callback()
} else {
this.close()
}
// 触发点击事件,传递按钮信息
this.$emit('buttonClick', button)
}
}
}
</script>
<style scoped lang="scss">
.popup-content {
background-color: #fff;
border-radius: toRpx(38);
width: toRpx(848);
height: toRpx(660);
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
overflow: hidden;
}
.popup-icon {
width: 100%;
margin-bottom: toRpx(48);
.icon-image {
width: 100%;
height: toRpx(248);
// border-radius: toRpx(38) toRpx(38) 0 0;
}
}
.popup-title {
font-size: toRpx(40);
font-weight: 500;
color: #333;
margin-bottom: toRpx(16);
text-align: center;
}
.popup-text {
font-size: 28rpx;
color: #666;
text-align: center;
margin-bottom: 32rpx;
line-height: 1.5;
}
.popup-buttons {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
gap: toRpx(32);
margin-top: auto;
height: toRpx(160);
}
.popup-button {
flex: 1;
height: toRpx(80);
line-height: toRpx(80);
text-align: center;
border-radius: toRpx(40);
font-size: toRpx(28);
max-width: toRpx(344);
&.single-button {
max-width: toRpx(688);
}
}
.button-primary {
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
}
.button-default {
background-color: #f5f5f5;
color: #333;
}
.button-danger {
background-color: #f45001;
color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view> <view>
<view class="shop-list"> <view class="shop-list">
<view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId"> <view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId">
<view class="sprite-icon icon-blue-delete"></view> <view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view class="right"> <view class="right">
<view class="shop-name">商品名称:{{ item.goods.goodsAlias || item.goods.upgradeGoodsName || <view class="shop-name">商品名称:{{ item.goods.goodsAlias || item.goods.upgradeGoodsName ||
item.goods.goodsInfo.goodsName }}</view> item.goods.goodsInfo.goodsName }}</view>
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<input class="uni-input" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="item.goods.sellPrice" @blur="validatePrice($event, item, index)" /> <input class="uni-input" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="item.goods.sellPrice" @blur="validatePrice($event, item, index)" />
</view> </view>
</view> </view>
<view class="control"> <view class="control">
<view class="minus" @click="decreaseNumber(item)">-</view> <view class="minus" @click="decreaseNumber(item)">-</view>
<input class="uni-input control-input" type="number" maxlength="3" v-model="item.goods.number" @input="validateNumber($event, item)" /> <input class="uni-input control-input" type="number" maxlength="3" v-model="item.goods.number" @input="validateNumber($event, item)" />
...@@ -105,6 +104,7 @@ export default { ...@@ -105,6 +104,7 @@ export default {
// 更新值 // 更新值
// this.$set(item.goods, 'sellPrice', value) // this.$set(item.goods, 'sellPrice', value)
this.$set(this.list[index].goods, 'sellPrice', value) this.$set(this.list[index].goods, 'sellPrice', value)
this.$emit('changeTotalPrice')
}, },
// 验证数量输入 // 验证数量输入
validateNumber(event, item) { validateNumber(event, item) {
...@@ -117,6 +117,7 @@ export default { ...@@ -117,6 +117,7 @@ export default {
} }
// 更新值 // 更新值
this.$set(item.goods, 'number', value) this.$set(item.goods, 'number', value)
this.$emit('changeTotalPrice')
}, },
// 增加数量 // 增加数量
increaseNumber(item) { increaseNumber(item) {
...@@ -128,6 +129,7 @@ export default { ...@@ -128,6 +129,7 @@ export default {
const newValue = currentValue >= 999 ? 999 : currentValue + 1 const newValue = currentValue >= 999 ? 999 : currentValue + 1
this.$set(item.goods, 'number', newValue.toString()) this.$set(item.goods, 'number', newValue.toString())
} }
this.$emit('changeTotalPrice')
}, },
// 减少数量 // 减少数量
decreaseNumber(item) { decreaseNumber(item) {
...@@ -140,6 +142,12 @@ export default { ...@@ -140,6 +142,12 @@ export default {
// 确保减少后的值不小于1 // 确保减少后的值不小于1
const newValue = Math.max(1, currentValue - 1) const newValue = Math.max(1, currentValue - 1)
this.$set(item.goods, 'number', newValue.toString()) this.$set(item.goods, 'number', newValue.toString())
this.$emit('changeTotalPrice')
},
// 删除商品
deleteGoods(index) {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
} }
} }
} }
......
...@@ -179,17 +179,17 @@ const FORM_LIST = [ ...@@ -179,17 +179,17 @@ const FORM_LIST = [
}, },
{ {
label: '套餐', label: '套餐',
value: 'couponInfo', value: 'package',
type: 'select', type: 'select',
key: 'name', key: 'name',
// addHtml: 'package' addHtml: 'package'
}, },
{ {
label: '其他精品', label: '其他精品',
value: 'couponInfo', value: 'skuGoods',
type: 'select', type: 'select',
key: 'name', key: 'name',
// addHtml: '' addHtml: 'skuGoods'
}, },
{ {
label: '收款方式', label: '收款方式',
...@@ -320,7 +320,31 @@ const popupTypeEnum = { ...@@ -320,7 +320,31 @@ const popupTypeEnum = {
6: { 6: {
key: 'frontGear', key: 'frontGear',
list: '', list: '',
} },
7: {
key: 'frontWindow',
list: '',
},
8: {
key: 'rearGear',
list: '',
},
9: {
key: 'rearWindow',
list: '',
},
10: {
key: 'sunRoof',
list: '',
},
11: {
key: 'package',
list: '',
},
12: {
key: 'skuGoods',
list: '',
},
} }
export { export {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<component :is="toolComponentName" @jump="jump" :transmission-of-data="transmissionOfData" /> <component :is="toolComponentName" @jump="jump" :transmission-of-data="transmissionOfData" />
</view> </view>
</view> </view>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view> </view>
</template> </template>
...@@ -31,6 +32,7 @@ import DailyReport from './components/DailyReport.vue' ...@@ -31,6 +32,7 @@ import DailyReport from './components/DailyReport.vue'
import DefeatOrder from './components/DefeatOrder.vue' import DefeatOrder from './components/DefeatOrder.vue'
import OrderManagement from './components/OrderManagement.vue' import OrderManagement from './components/OrderManagement.vue'
import ConfirmOrder from './components/ConfirmOrder.vue' import ConfirmOrder from './components/ConfirmOrder.vue'
import NoticePopup from './components/NoticePopup.vue'
export default { export default {
components: { components: {
Entrance, Entrance,
...@@ -38,7 +40,8 @@ export default { ...@@ -38,7 +40,8 @@ export default {
DailyReport, DailyReport,
DefeatOrder, DefeatOrder,
OrderManagement, OrderManagement,
ConfirmOrder ConfirmOrder,
NoticePopup
}, },
data() { data() {
return { return {
...@@ -52,10 +55,38 @@ export default { ...@@ -52,10 +55,38 @@ export default {
methods: { methods: {
entranceClick(item) { entranceClick(item) {
console.log(item) console.log(item)
this.toolComponentName = item.name // 保存当前选择的组件信息,但不立即切换
if (item.name !== 'CreateOrder') { const selectedItem = item
// 如果当前组件是OrderManagement,直接切换组件,不显示弹窗
if (this.toolComponentName === 'OrderManagement') {
this.toolComponentName = selectedItem.name
this.transmissionOfData = null
return
}
// 配置弹窗按钮
this.$refs.notice.buttons = [{
text: '确认退出',
type: 'default',
callback: () => {
// 点击确认后才切换组件
this.toolComponentName = selectedItem.name
if (selectedItem.name !== 'CreateOrder') {
this.transmissionOfData = null this.transmissionOfData = null
} }
this.$refs.notice.close()
}
}, {
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}]
// 打开弹窗
this.$refs.notice.open()
}, },
backPage() { backPage() {
uni.navigateBack() uni.navigateBack()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!