Commit f73a4bca by 胡悦

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

2 parents b38033eb 0e8be092
...@@ -181,7 +181,7 @@ module.exports = { ...@@ -181,7 +181,7 @@ module.exports = {
}) })
}, },
// 根据商户号获取可选商品列表 // 根据商户号获取可选商品列表
getSelectOrderGoodsList(data){ getSelectOrderGoodsList(data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.selectOrderGoods.list', method: 'dj.api.smartcarlife.selectOrderGoods.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -236,4 +236,8 @@ module.exports = { ...@@ -236,4 +236,8 @@ module.exports = {
...data ...data
}) })
}, },
/**根据订单号获取订单详情(含套餐) */
getPackageGoodsDetail(data) {
return http.post({ method: 'dj.api.smartcarlife.order.packageGoodsDetail', projectName: 'boutique', ...data })
}
} }

2.56 MB | W: | H:

2.56 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) {
......
...@@ -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: {
...@@ -182,13 +190,21 @@ export default { ...@@ -182,13 +190,21 @@ export default {
else componentRef.handleSearch(this.componentObject.searchValue) else componentRef.handleSearch(this.componentObject.searchValue)
}, },
confirm () { confirm () {
let { chooseContent, popupType } = this let { chooseContent, popupType, componentObject } = this
if (popupType === 13) {
chooseContent = this.componentRef().getResult()
}
if (chooseContent) { if (chooseContent) {
this.$emit('onConfirm', { this.$emit('onConfirm', {
chooseContent, chooseContent,
popupType popupType
}) })
this.$refs.popup.close() this.$refs.popup.close()
} else {
if (componentObject.nullTips) uni.showToast({
title: componentObject.nullTips,
icon: 'none'
})
} }
}, },
openSkuPopup (data) { openSkuPopup (data) {
...@@ -271,9 +287,23 @@ export default { ...@@ -271,9 +287,23 @@ 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 {
......
...@@ -10,29 +10,29 @@ ...@@ -10,29 +10,29 @@
<view class="box-shell"> <view class="box-shell">
<view class="box-shell-title">商品信息</view> <view class="box-shell-title">商品信息</view>
<view class="good-list"> <view class="good-list">
<view class="good"> <view class="good" v-for="(item, index) in orderInfo.subOrderList">
<view class="flex justify-between align-center"> <view class="flex justify-between align-center">
<text class="good-name">商品名称:</text> <text class="good-name">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
<text class="good-price">¥1000</text> <text class="good-price">¥{{ item.price }}</text>
</view> </view>
<view class="flex justify-between align-center pt-6"> <view class="flex justify-between align-center pt-6">
<text class="good-alias">商品别名:</text> <text class="good-alias">商品别名:{{ replaceItemText(item.upgradeGoodsAlias) || '' }}</text>
</view> </view>
<view class="flex align-center pt-12"> <view class="flex align-center pt-12">
<text class="good-sku">天窗玻璃</text> <text class="good-sku">{{ item.positionStr || item.upgradeGoodsTypeName }}</text>
<text class="good-count">x2</text> <text class="good-count">x{{ item.number }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="flex align-center py-8"> <view class="flex align-center py-8">
<view class="sprite-icon icon-coupon fs-14"></view> <view class="sprite-icon icon-coupon fs-14"></view>
<text class="fs-14 coupon-name">贴膜抵用券GH647-039(系统)</text> <text class="fs-14 coupon-name">{{ orderInfo.couponName || '' }}{{ orderInfo.customerCoupon.customerCouponCode || '' }}({{ orderInfo.customerCoupon.employeeName || '' }})</text>
</view> </view>
<view class="flex justify-end align-center"> <view class="flex justify-end align-center">
<text class="good-total-lable">商品总金额:</text> <text class="good-total-lable">商品总金额:</text>
<text class="good-total-value"> <text class="good-total-value">
<text class="unit">¥</text> <text class="unit">¥</text>
{{ toPrice(218.98887, 2) }} {{ orderInfo.total_price }}
</text> </text>
</view> </view>
</view> </view>
...@@ -43,9 +43,8 @@ ...@@ -43,9 +43,8 @@
<view v-for="(item, index) in orderObj" :key="index" class="flex align-center pt-8"> <view v-for="(item, index) in orderObj" :key="index" class="flex align-center pt-8">
<view class="label">{{ item.label }}</view> <view class="label">{{ item.label }}</view>
<view v-if="item.key == 'status'"> <view v-if="item.key == 'status'">
<view class="value" :style="{ color: item.constructionFlag == 'Y' ? status[orderInfo.status].color : '' }"> <view class="value" :style="{ color: status[orderInfo.status].color || '' }">
<!-- {{ item.constructionFlag == 'Y'? status[orderInfo.status].text: '待施工'}} --> {{ status[orderInfo.status].text }}
<!-- {{ status[orderInfo.status].text }} -->
</view> </view>
</view> </view>
<view v-else> <view v-else>
...@@ -56,10 +55,8 @@ ...@@ -56,10 +55,8 @@
<view v-else>{{ orderInfo[item.key] || '' }}</view> <view v-else>{{ orderInfo[item.key] || '' }}</view>
</view> </view>
</view> </view>
<view v-if="item.copy"> <view v-if="item.copy" class="copy-btn" @click="copyText">
<view class="copy" @click="setCopyData"> <view class="sprite-icon icon-icon-copy copy"></view>
<!-- 复制 -->
</view>
</view> </view>
</view> </view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length"> <view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
...@@ -134,22 +131,173 @@ ...@@ -134,22 +131,173 @@
<script> <script>
import utils from '@/utils/utils' import utils from '@/utils/utils'
import order_mixins from '../../order_mixins.js' import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
export default { export default {
name: 'OrderConfirm', name: 'OrderConfirm',
props: { props: {
orderInfo: { orderObjData: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
} }
}, },
data() { data() {
return { return {
...order_mixins.data ...order_mixins.data,
positionTypeList: [],
isErrorOrder: false,
orderInfo: {}
} }
}, },
mounted() {
this.getPositionList()
this.getDetail('250819144103724')
},
methods: { methods: {
toPrice(val, num) { replaceItemText(item) {
return Number(utils.decimal(val, num)).toFixed(2) var reg = getRegExp(';~;', 'g')
return item ? item.replace(reg, ' ') : ''
},
async getDetail(orderCode) {
// console.log(orderCode)
let _this = this
uni.$api.boutiqueApi
.getPackageGoodsDetail({
orderCode
})
.then(data => {
if (data.payOrder && data.payOrder.payStatus == 2) {
if (time) clearInterval(time)
// wx.$router.redirectTo('orderDetail', {
// orderCode
// })
return
}
let couponName = data.customerCoupon ? data.customerCoupon.couponName : ''
let total_price = 0
let warrantyCardList = []
for (var i = 0; i < data?.subOrderList?.length; i++) {
let e = data?.subOrderList[i]
total_price += e.totalPrice
e.price = Number(utils.decimal(Number(e.totalPrice / e.number), 2)).toFixed(2)
e.positionStr = this.positionTypeList.filter(v => v.positionValue == e.upgradeGoodsPosition)[0]?.positionName || ''
if (e.upgradeWarrantyPeriod || e.upgradeWarrantyPeriod > 0) {
warrantyCardList.push({
warrantyPeriod: e.upgradeWarrantyPeriod,
goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName
})
}
}
data.packageGoodsList?.forEach(item => {
item.packageGoodsOrderList.forEach(g => {
g.price = g.totalPrice ? Number(g.totalPrice) / Number(g.number) : g.upgradePrice
})
item.goodsList = item.packageGoodsOrderList
item.price = item.goodsList.reduce((prev, cur) => {
return prev + Number(cur.totalPrice) / Number(cur.number)
}, 0)
item.count = item.goodsList.length ? item.goodsList[0].number : 1
let total = item.price * item.count
item.totalPrice = utils.decimal(total, 2)
item.packageGoodsOrderList.forEach(g => {
g.positionStr = this.positionTypeList.filter(v => v.positionValue == g.upgradeGoodsPosition)[0]?.positionName || ''
})
total_price += item.totalPrice
})
data = {
...data.customer,
...data.payOrder,
...data,
packageGoodsList: data.packageGoodsList,
couponName,
total_price: Number(utils.decimal(total_price, 2)).toFixed(2)
}
if (data.orderTime) data.time = dayjs(new Date(data.orderTime)).format('YYYY-MM-DD HH:mm:ss')
if (data.customerCoupon) {
data.customerCoupon.customerCouponCode = data.customerCoupon.customerCouponCode.split('-')[0]
}
if (data.customer.carSeriesName) {
data.carType = `${data.customer.carBrand || ''}-${data.customer.carChildsBrandName || ''}-${data.customer.carSeriesName || ''}`
}
_this.orderInfo = data
_this.flag = true
_this.warrantyCardList = warrantyCardList
// 校验是否显示二级流量方
if (data.subShopMerchantName) {
if (_this.customerObj.findIndex(val => val?.key && val.key == 'subShopMerchantName') < 0) {
_this.customerObj[_this.customerObj.length - 2] = {
label: '二级流量方',
key: 'subShopMerchantName'
}
}
}
// 是2:门店收款 5:嘀加收款 6:对公转账 7:其它收款并且不是错误订单 自动打开门店收款弹窗
if (!_this.isErrorOrder && [2, 5, 6, 7].includes(Number(data.selectPayType))) {
_this.toshowDateModal()
}
// 获取园区店技师配置信息
uni.$api.boutiqueApi
.getQYTechnicianList({
yqMerchantId: uni.$storage.get('userInfo')?.merchantId
})
.then(respone => {
if (respone?.code == 0) {
if (respone?.data.length > 0) this.isArtificer(respone.data)
}
})
// } else {
// wx.showModal({
// title: '温馨提示',
// content: message,
// showCancel: false,
// confirmText: '刷新',
// confirmColor: '#347BFF',
// success(res) {
// if (res.confirm) {
// _this.getDetail(orderCode)
// }
// }
// })
// }
})
},
async getPackageGoodsDetail(orderCode) {
try {
let params = {
orderCode
}
let { total_price } = this.data.orderInfo
uni.$api.boutiqueApi.getPackageGoodsDetail(params).then(res => {
res.data?.packageGoodsList.forEach(item => {
item.packageGoodsOrderList.forEach(g => {
g.price = g.totalPrice ? Number(g.totalPrice) / Number(g.number) : g.upgradePrice
})
item.goodsList = item.packageGoodsOrderList
item.price = item.goodsList.reduce((prev, cur) => {
return prev + Number(cur.totalPrice) / Number(cur.number)
}, 0)
item.count = item.goodsList.length ? item.goodsList[0].number : 1
let total = item.price * item.count
item.totalPrice = utils.decimal(total, 2)
item.packageGoodsOrderList.forEach(g => {
g.positionStr = this.positionTypeList.filter(v => v.positionValue == g.upgradeGoodsPosition)[0]?.positionName || ''
})
total_price = Number(total_price) + Number(item.totalPrice)
})
if (res.code == 0) {
this.setData({
packageGoodsList: res.data.packageGoodsList,
'orderInfo.total_price': Number(utils.decimal(total_price, 2)).toFixed(2)
})
}
})
} catch (err) {}
},
async getPositionList() {
const res = await uni.$api.boutiqueApi.getPositionList({})
this.positionTypeList = res
} }
} }
} }
......
...@@ -35,13 +35,12 @@ ...@@ -35,13 +35,12 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 弹窗 --> <!-- 弹窗 -->
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" <order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" />
:popupType="popupType" />
</view> </view>
</template> </template>
<script> <script>
import utils from "@/utils/utils"; import utils from '@/utils/utils'
import OrderPopup from '@/components/OrderPopup/index.vue' import OrderPopup from '@/components/OrderPopup/index.vue'
import GlCell from '../../../../components/Form/GlCell.vue' import GlCell from '../../../../components/Form/GlCell.vue'
import Product from './Product.vue' import Product from './Product.vue'
...@@ -157,21 +156,21 @@ export default { ...@@ -157,21 +156,21 @@ export default {
handleCell(val) { handleCell(val) {
console.log(val, this.orderObj) console.log(val, this.orderObj)
// 获取当前选中的popupType // 获取当前选中的popupType
this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key].key === val.value) * 1; this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key].key === val.value) * 1
// 获取对应的list字段 // 获取对应的list字段
const popupConfig = this.popupTypeEnum[this.popupType]; const popupConfig = this.popupTypeEnum[this.popupType]
if (popupConfig && popupConfig.list) { if (popupConfig && popupConfig.list) {
this.externalData = this[popupConfig.list] || []; this.externalData = this[popupConfig.list] || []
} else { } else {
this.externalData = []; this.externalData = []
} }
// 定义产品相关字段数组 // 定义产品相关字段数组
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']; const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']
if (productFields.includes(val.value)) { if (productFields.includes(val.value)) {
this.valueKey = val.value; this.valueKey = val.value
} }
console.log(this.popupType, this.externalData, '-------------') console.log(this.popupType, this.externalData, '-------------')
this.$refs.orderPopup.open(); this.$refs.orderPopup.open()
}, },
// 单选框change事件 // 单选框change事件
radioChange(e, val) { radioChange(e, val) {
...@@ -186,7 +185,7 @@ export default { ...@@ -186,7 +185,7 @@ export default {
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']; const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof'];
...@@ -224,71 +223,71 @@ export default { ...@@ -224,71 +223,71 @@ export default {
this.orderObj.customer[val.value] = this.orderObj[val.value] this.orderObj.customer[val.value] = this.orderObj[val.value]
}, },
checkRequired() { checkRequired() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/
// 把formList中所有required为true的对象放到一个数组中 // 把formList中所有required为true的对象放到一个数组中
const requiredArr = []; const requiredArr = []
const onlyLabelItem = []; const onlyLabelItem = []
this.formList.forEach(group => { this.formList.forEach(group => {
group.forEach(item => { group.forEach(item => {
if (item.required === true && item.hidden !== true) { if (item.required === true && item.hidden !== true) {
if (item.onlyLabel === true) { if (item.onlyLabel === true) {
onlyLabelItem.push(item); onlyLabelItem.push(item)
} else { } else {
requiredArr.push(item); requiredArr.push(item)
} }
} }
}); })
}); })
// 遍历requiredArr,检查orderObj中是否有对应的值 // 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) { for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i]; const item = requiredArr[i]
// 兼容嵌套customer对象的情况 // 兼容嵌套customer对象的情况
let value; let value
if (item.value === 'customerName' || item.value === 'customerPhone' || item.value === 'standNo' || item.value === 'plateNumber') { if (item.value === 'customerName' || item.value === 'customerPhone' || item.value === 'standNo' || item.value === 'plateNumber') {
value = this.orderObj.customer ? this.orderObj.customer[item.value] : undefined; value = this.orderObj.customer ? this.orderObj.customer[item.value] : undefined
} else { } else {
value = this.orderObj[item.value]; value = this.orderObj[item.value]
} }
// 0、false、'0'等视为有效,null/undefined/空字符串视为无效 // 0、false、'0'等视为有效,null/undefined/空字符串视为无效
if (value === undefined || value === null || value === '') { if (value === undefined || value === null || value === '') {
uni.showToast({ uni.showToast({
title: `${item.label}不能为空`, title: `${item.label}不能为空`,
icon: 'none' icon: 'none'
}); })
return false; return false
} }
// 如果是customerPhone,添加phoneRex校验 // 如果是customerPhone,添加phoneRex校验
if (item.value === 'customerPhone' && !phoneRex.test(value)) { if (item.value === 'customerPhone' && !phoneRex.test(value)) {
uni.showToast({ uni.showToast({
title: `请输入正确的${item.label}`, title: `请输入正确的${item.label}`,
icon: 'none' icon: 'none'
}); })
return false; return false
} }
} }
// 处理onlyLabel为true的特殊校验 // 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) { if (onlyLabelItem.length > 0) {
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空 // 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
const labelFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']; const labelFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']
const hasValue = labelFields.some(field => { const hasValue = labelFields.some(field => {
console.log(field, this.orderObj[field]) console.log(field, this.orderObj[field])
const value = this.orderObj[field]; const value = this.orderObj[field]
return value !== undefined && value !== null && (Array.isArray(value) ? value.length > 0 : value !== ''); return value !== undefined && value !== null && (Array.isArray(value) ? value.length > 0 : value !== '')
}); })
console.log(hasValue, hasValue) console.log(hasValue, hasValue)
if (!hasValue) { if (!hasValue) {
uni.showToast({ uni.showToast({
title: '请至少选择一个产品', title: '请至少选择一个产品',
icon: 'none' icon: 'none'
}); })
return false; return false
} }
} }
return true; return true
}, },
// 提交 // 提交
...@@ -336,6 +335,7 @@ export default { ...@@ -336,6 +335,7 @@ export default {
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
}) })
this.$emit('jump', 'ConfirmOrder', res.data)
} }
}, },
// 计算所有产品的总价 // 计算所有产品的总价
...@@ -386,7 +386,7 @@ export default { ...@@ -386,7 +386,7 @@ export default {
console.log(res, '流量方') console.log(res, '流量方')
if (res && res.length) { if (res && res.length) {
this.subShopMerchantList = res this.subShopMerchantList = res
const cell = this.formList[0].find(item => item.label === '二级流量方'); const cell = this.formList[0].find(item => item.label === '二级流量方')
if (cell) { if (cell) {
cell.hidden = false cell.hidden = false
} }
...@@ -429,11 +429,11 @@ export default { ...@@ -429,11 +429,11 @@ export default {
}) })
console.log(res) console.log(res)
let m = res.supportPayTypes || [] let m = res.supportPayTypes || []
let n = this.payTypeList; let n = this.payTypeList
let list = n.filter((k) => { let list = n.filter(k => {
let idx = m.find((j) => j == k.value); let idx = m.find(j => j == k.value)
return idx >= 0; return idx >= 0
}); })
// this.configPayTypeList = list // this.configPayTypeList = list
this.djPayList = [ this.djPayList = [
...list?.filter(v => ![2, 5].includes(Number(v.value))), ...list?.filter(v => ![2, 5].includes(Number(v.value))),
...@@ -446,16 +446,14 @@ export default { ...@@ -446,16 +446,14 @@ export default {
value: '7' value: '7'
} }
] ]
this.merchantPayList = [ this.merchantPayList = [...list?.filter(v => v.value == 2)]
...list?.filter(v => v.value == 2)
]
this.changePayee() this.changePayee()
console.log(this.djPayList, this.merchantPayList, 'list') console.log(this.djPayList, this.merchantPayList, 'list')
}, },
changePayee() { changePayee() {
const cell = this.formList[2].find(item => item.value === 'selectPayType'); const cell = this.formList[2].find(item => item.value === 'selectPayType')
if (cell) { if (cell) {
cell.radioList = this.orderObj.payeeType == 1 ? this.merchantPayList : this.djPayList; cell.radioList = this.orderObj.payeeType == 1 ? this.merchantPayList : this.djPayList
if (cell.radioList && cell.radioList.length > 0) { if (cell.radioList && cell.radioList.length > 0) {
cell.current = cell.radioList[0].value cell.current = cell.radioList[0].value
this.orderObj.selectPayType = cell.radioList[0].value this.orderObj.selectPayType = cell.radioList[0].value
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</view> </view>
</view> </view>
<view class="detail-right"> <view class="detail-right">
<component :is="toolComponentName" @jump="jump" :selected-trade-data="selectedTradeData" /> <component :is="toolComponentName" @jump="jump" :transmission-of-data="transmissionOfData" />
</view> </view>
</view> </view>
</view> </view>
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
data() { data() {
return { return {
toolComponentName: '', toolComponentName: '',
selectedTradeData: null transmissionOfData: null
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
console.log(item) console.log(item)
this.toolComponentName = item.name this.toolComponentName = item.name
if (item.name !== 'CreateOrder') { if (item.name !== 'CreateOrder') {
this.selectedTradeData = null this.transmissionOfData = null
} }
}, },
backPage() { backPage() {
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
this.toolComponentName = name this.toolComponentName = name
console.log(this.toolComponentName) console.log(this.toolComponentName)
if (val) { if (val) {
this.selectedTradeData = val this.transmissionOfData = val
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!