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,15 +181,15 @@ module.exports = {
})
},
// 根据商户号获取可选商品列表
getSelectOrderGoodsList(data){
getSelectOrderGoodsList(data) {
return http.post({
method: 'dj.api.smartcarlife.selectOrderGoods.list',
projectName: 'boutique',
...data
})
},
/** 选择支付方式下单 */
createWithPay(data) {
/** 选择支付方式下单 */
createWithPay(data) {
console.log(data)
return http.post({
method: 'dj.api.smartcarlife.order.createWithPay',
......@@ -205,8 +205,8 @@ module.exports = {
...data
})
},
// 获取精品升级场景 太阳膜类商品部位数据
getPositionList(data) {
// 获取精品升级场景 太阳膜类商品部位数据
getPositionList(data) {
return http.post({
method: 'dj.api.smartcarlife.goodsPosition.list',
projectName: 'boutique',
......@@ -236,4 +236,8 @@ module.exports = {
...data
})
},
/**根据订单号获取订单详情(含套餐) */
getPackageGoodsDetail(data) {
return http.post({ method: 'dj.api.smartcarlife.order.packageGoodsDetail', projectName: 'boutique', ...data })
}
}
......@@ -348,4 +348,4 @@
.icon-expiration { width: calc(100vmin * (1173 / 768) * 0.04092071611253197); height: calc(100vmin * (1173 / 768) * 0.04092071611253197);
background-position: calc(100vmin * (1173 / 768) * -0.09462915601023018) calc(100vmin * (1173 / 768) * -0.5839727195225917);}
.icon-revoke { width: calc(100vmin * (1173 / 768) * 0.04092071611253197); height: calc(100vmin * (1173 / 768) * 0.04092071611253197);
background-position: calc(100vmin * (1173 / 768) * -0.14194373401534527) calc(100vmin * (1173 / 768) * -0.5839727195225917);}
\ No newline at end of file
background-position: calc(100vmin * (1173 / 768) * -0.14194373401534527) calc(100vmin * (1173 / 768) * -0.5839727195225917);}

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 @@
:class="[
{'sub-brand-name':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)"
>
<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}}
</view>
</template>
......@@ -132,7 +135,7 @@ export default {
}
})
this.list = carModelList
this.$emit('onComplete')
},
handleSearch (searchValue) {
if (!searchValue) {
......
......@@ -114,6 +114,7 @@ export default {
list,
};
})
this.$emit('onComplete')
this.list = couponList
},
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
......@@ -35,6 +35,7 @@ export default {
{ cacheData } = params
this.currentId = ''
if (cacheData && cacheData.length) {
this.$emit('onComplete')
this.list = cacheData
return
}
......@@ -42,6 +43,7 @@ export default {
merchantId: shopMerchantId
})
if (data && data.length) {
this.$emit('onComplete')
this.list = data
params.cacheData = data
this.$emit('update:params', params)
......
......@@ -36,6 +36,7 @@ export default {
{ cacheData } = params
this.currentId = ''
if (!search && cacheData && cacheData.length) {
this.$emit('onComplete')
this.list = cacheData
return
}
......@@ -46,6 +47,7 @@ export default {
name: searchValue
})
if (data && data.length) {
this.$emit('onComplete')
this.list = data
params.cacheData = data
this.$emit('update:params', params)
......
......@@ -100,6 +100,7 @@ export default {
this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e)
})
this.$emit('onComplete')
return arr
},
choose (i) {
......
......@@ -40,7 +40,7 @@
<script type='text/ecmascript-6'>
import NP from 'number-precision'
export default {
name: 'GoodsList',
name: 'PackageList',
inject: ['userInfo', 'baseConfigData'],
data () {
return {
......@@ -115,6 +115,7 @@ export default {
this.currentIds.push(e.packageGoods.packageCode)
this.chooseList.push(e)
})
this.$emit('onComplete')
return arr
},
choose (i) {
......
......@@ -24,7 +24,7 @@
<script type='text/ecmascript-6'>
export default {
name: '',
name: 'Popup',
props: {
animation: {
type: Boolean,
......
......@@ -87,7 +87,7 @@
<script type='text/ecmascript-6'>
export default {
name: 'GoodsList',
name: 'SkuGoodsList',
inject: ['userInfo', 'baseConfigData'],
data () {
return {
......@@ -184,6 +184,7 @@ export default {
this.chooseList.push(e)
}
})
this.$emit('onComplete')
return arr
},
async choose (i, index) {
......
......@@ -60,7 +60,7 @@ export default {
components: {
Popup,
},
name: '',
name: 'SkuPopup',
props: {
},
......
......@@ -27,6 +27,7 @@ const componentConfig = {
name: 'EmployeeList',
title: '交付专员',
placeholder: '请输入姓名',
nullTips: '请选择交付专员',
idKey: 'deliveryUserId'
},
2: {
......@@ -51,13 +52,15 @@ const componentConfig = {
name: 'CouponList',
title: '选择礼券',
placeholder: '查找',
idKey: 'customerCouponCode'
idKey: 'customerCouponCode',
nullTips: '优惠券不能为空'
},
6: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [1]//前档
},
7: {
......@@ -65,13 +68,15 @@ const componentConfig = {
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
goodsType:[2] // 前侧窗玻璃
nullTips: '请勾选商品',
goodsType: [2] // 前侧窗玻璃
},
8: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [3] // 后侧窗玻璃
},
9: {
......@@ -79,6 +84,7 @@ const componentConfig = {
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [4] // 后档
},
10: {
......@@ -86,19 +92,27 @@ const componentConfig = {
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
goodsType:[5, 6, 7] // 天窗
nullTips: '请勾选商品',
goodsType: [5, 6, 7] // 天窗
},
11:{
11: {
name: 'PackageList',
title: '选择套餐',
placeholder:'查找',
placeholder: '查找',
nullTips: '请勾选套餐',
idKey: 'packageCode'
},
12:{
name:'SkuGoodsList',
12: {
name: 'SkuGoodsList',
title: '选择商品',
placeholder:'查找',
nullTips: '请勾选商品',
placeholder: '查找',
},
13: {
name: 'DateTime',
title: '选择时间',
hideSearch: true,
}
}
export default { componentConfig}
\ No newline at end of file
export default { componentConfig }
\ No newline at end of file
......@@ -45,7 +45,7 @@
<view :class="['popup-body',{ 'hide-search' :componentObject.hideSearch}]">
<scroll-view
scroll-y
class="popup-scroll-view"
:class="['popup-scroll-view',{show:loadComplete}]"
>
<component
:is="componentObject.name"
......@@ -55,9 +55,14 @@
ref="componentRef"
@choose="chooseContent = $event"
@openSkuPopup="openSkuPopup"
@onComplete="loadComplete = true"
></component>
</scroll-view>
<image
v-if="!loadComplete"
class="loading"
src="../../assets/images/common/loadding.gif"
/>
</view>
</popup>
<sku-popup
......@@ -78,6 +83,7 @@ import GoodsList from './components/GoodsList.vue'
import PackageList from './components/PackageList.vue'
import SkuGoodsList from './components/SkuGoodsList.vue'
import SkuPopup from './components/SkuPopup.vue'
import DateTime from './components/DateTime.vue'
export default {
components: {
Popup,
......@@ -88,7 +94,8 @@ export default {
GoodsList,
PackageList,
SkuGoodsList,
SkuPopup
SkuPopup,
DateTime
},
name: '',
props: {
......@@ -121,6 +128,7 @@ export default {
position: 'bottom',
chooseContent: null,
componentObject: null,
loadComplete: false
}
},
watch: {
......@@ -182,16 +190,24 @@ export default {
else componentRef.handleSearch(this.componentObject.searchValue)
},
confirm () {
let { chooseContent, popupType } = this
let { chooseContent, popupType, componentObject } = this
if (popupType === 13) {
chooseContent = this.componentRef().getResult()
}
if (chooseContent) {
this.$emit('onConfirm', {
chooseContent,
popupType
})
this.$refs.popup.close()
} else {
if (componentObject.nullTips) uni.showToast({
title: componentObject.nullTips,
icon: 'none'
})
}
},
openSkuPopup (data) {
openSkuPopup (data) {
this.confirm()
this.$refs.skuPopupRef.open(data)
},
......@@ -271,9 +287,23 @@ export default {
}
.popup-body {
height: calc(100% - 392rpx);
position: relative;
.popup-scroll-view {
height: 100%;
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 {
......
......@@ -10,29 +10,29 @@
<view class="box-shell">
<view class="box-shell-title">商品信息</view>
<view class="good-list">
<view class="good">
<view class="good" v-for="(item, index) in orderInfo.subOrderList">
<view class="flex justify-between align-center">
<text class="good-name">商品名称:</text>
<text class="good-price">¥1000</text>
<text class="good-name">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
<text class="good-price">¥{{ item.price }}</text>
</view>
<view class="flex justify-between align-center pt-6">
<text class="good-alias">商品别名:</text>
<text class="good-alias">商品别名:{{ replaceItemText(item.upgradeGoodsAlias) || '' }}</text>
</view>
<view class="flex align-center pt-12">
<text class="good-sku">天窗玻璃</text>
<text class="good-count">x2</text>
<text class="good-sku">{{ item.positionStr || item.upgradeGoodsTypeName }}</text>
<text class="good-count">x{{ item.number }}</text>
</view>
</view>
</view>
<view class="flex align-center py-8">
<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 class="flex justify-end align-center">
<text class="good-total-lable">商品总金额:</text>
<text class="good-total-value">
<text class="unit">¥</text>
{{ toPrice(218.98887, 2) }}
{{ orderInfo.total_price }}
</text>
</view>
</view>
......@@ -43,9 +43,8 @@
<view v-for="(item, index) in orderObj" :key="index" class="flex align-center pt-8">
<view class="label">{{ item.label }}</view>
<view v-if="item.key == 'status'">
<view class="value" :style="{ color: item.constructionFlag == 'Y' ? status[orderInfo.status].color : '' }">
<!-- {{ item.constructionFlag == 'Y'? status[orderInfo.status].text: '待施工'}} -->
<!-- {{ status[orderInfo.status].text }} -->
<view class="value" :style="{ color: status[orderInfo.status].color || '' }">
{{ status[orderInfo.status].text }}
</view>
</view>
<view v-else>
......@@ -56,10 +55,8 @@
<view v-else>{{ orderInfo[item.key] || '' }}</view>
</view>
</view>
<view v-if="item.copy">
<view class="copy" @click="setCopyData">
<!-- 复制 -->
</view>
<view v-if="item.copy" class="copy-btn" @click="copyText">
<view class="sprite-icon icon-icon-copy copy"></view>
</view>
</view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
......@@ -134,22 +131,173 @@
<script>
import utils from '@/utils/utils'
import order_mixins from '../../order_mixins.js'
import dayjs from 'dayjs'
export default {
name: 'OrderConfirm',
props: {
orderInfo: {
orderObjData: {
type: Object,
default: () => ({})
}
},
data() {
return {
...order_mixins.data
...order_mixins.data,
positionTypeList: [],
isErrorOrder: false,
orderInfo: {}
}
},
mounted() {
this.getPositionList()
this.getDetail('250819144103724')
},
methods: {
toPrice(val, num) {
return Number(utils.decimal(val, num)).toFixed(2)
replaceItemText(item) {
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 @@
</scroll-view>
</view>
<!-- 弹窗 -->
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData"
:popupType="popupType" />
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" />
</view>
</template>
<script>
import utils from "@/utils/utils";
import utils from '@/utils/utils'
import OrderPopup from '@/components/OrderPopup/index.vue'
import GlCell from '../../../../components/Form/GlCell.vue'
import Product from './Product.vue'
......@@ -157,21 +156,21 @@ export default {
handleCell(val) {
console.log(val, this.orderObj)
// 获取当前选中的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字段
const popupConfig = this.popupTypeEnum[this.popupType];
const popupConfig = this.popupTypeEnum[this.popupType]
if (popupConfig && popupConfig.list) {
this.externalData = this[popupConfig.list] || [];
this.externalData = this[popupConfig.list] || []
} else {
this.externalData = [];
this.externalData = []
}
// 定义产品相关字段数组
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof'];
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof']
if (productFields.includes(val.value)) {
this.valueKey = val.value;
this.valueKey = val.value
}
console.log(this.popupType, this.externalData, '-------------')
this.$refs.orderPopup.open();
this.$refs.orderPopup.open()
},
// 单选框change事件
radioChange(e, val) {
......@@ -186,7 +185,7 @@ export default {
console.log(val, 'onConfirm')
const { chooseContent } = val
// 根据popupTypeEnum优化处理
const _typeValue = this.popupTypeEnum[this.popupType];
const _typeValue = this.popupTypeEnum[this.popupType]
console.log(_typeValue)
// 定义产品相关字段数组
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof'];
......@@ -224,74 +223,74 @@ export default {
this.orderObj.customer[val.value] = this.orderObj[val.value]
},
checkRequired() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
const phoneRex = /^[1]([3-9])[0-9]{9}$/
// 把formList中所有required为true的对象放到一个数组中
const requiredArr = [];
const onlyLabelItem = [];
const requiredArr = []
const onlyLabelItem = []
this.formList.forEach(group => {
group.forEach(item => {
if (item.required === true && item.hidden !== true) {
if (item.onlyLabel === true) {
onlyLabelItem.push(item);
onlyLabelItem.push(item)
} else {
requiredArr.push(item);
requiredArr.push(item)
}
}
});
});
})
})
// 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i];
const item = requiredArr[i]
// 兼容嵌套customer对象的情况
let value;
let value
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 {
value = this.orderObj[item.value];
value = this.orderObj[item.value]
}
// 0、false、'0'等视为有效,null/undefined/空字符串视为无效
if (value === undefined || value === null || value === '') {
uni.showToast({
title: `${item.label}不能为空`,
icon: 'none'
});
return false;
})
return false
}
// 如果是customerPhone,添加phoneRex校验
if (item.value === 'customerPhone' && !phoneRex.test(value)) {
uni.showToast({
title: `请输入正确的${item.label}`,
icon: 'none'
});
return false;
})
return false
}
}
// 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) {
// 检查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 => {
console.log(field, this.orderObj[field])
const value = this.orderObj[field];
return value !== undefined && value !== null && (Array.isArray(value) ? value.length > 0 : value !== '');
});
const value = this.orderObj[field]
return value !== undefined && value !== null && (Array.isArray(value) ? value.length > 0 : value !== '')
})
console.log(hasValue, hasValue)
if (!hasValue) {
uni.showToast({
title: '请至少选择一个产品',
icon: 'none'
});
return false;
})
return false
}
}
return true;
return true
},
// 提交
async submit() {
console.log(this.orderObj)
if (!this.checkRequired()) return
......@@ -336,6 +335,7 @@ export default {
title: '保存成功',
icon: 'success'
})
this.$emit('jump', 'ConfirmOrder', res.data)
}
},
// 计算所有产品的总价
......@@ -386,7 +386,7 @@ export default {
console.log(res, '流量方')
if (res && res.length) {
this.subShopMerchantList = res
const cell = this.formList[0].find(item => item.label === '二级流量方');
const cell = this.formList[0].find(item => item.label === '二级流量方')
if (cell) {
cell.hidden = false
}
......@@ -429,11 +429,11 @@ export default {
})
console.log(res)
let m = res.supportPayTypes || []
let n = this.payTypeList;
let list = n.filter((k) => {
let idx = m.find((j) => j == k.value);
return idx >= 0;
});
let n = this.payTypeList
let list = n.filter(k => {
let idx = m.find(j => j == k.value)
return idx >= 0
})
// this.configPayTypeList = list
this.djPayList = [
...list?.filter(v => ![2, 5].includes(Number(v.value))),
......@@ -446,16 +446,14 @@ export default {
value: '7'
}
]
this.merchantPayList = [
...list?.filter(v => v.value == 2)
]
this.merchantPayList = [...list?.filter(v => v.value == 2)]
this.changePayee()
console.log(this.djPayList, this.merchantPayList, 'list')
},
changePayee() {
const cell = this.formList[2].find(item => item.value === 'selectPayType');
const cell = this.formList[2].find(item => item.value === 'selectPayType')
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) {
cell.current = cell.radioList[0].value
this.orderObj.selectPayType = cell.radioList[0].value
......
......@@ -18,7 +18,7 @@
</view>
</view>
<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>
......@@ -43,7 +43,7 @@ export default {
data() {
return {
toolComponentName: '',
selectedTradeData: null
transmissionOfData: null
}
},
onLoad(options) {
......@@ -54,7 +54,7 @@ export default {
console.log(item)
this.toolComponentName = item.name
if (item.name !== 'CreateOrder') {
this.selectedTradeData = null
this.transmissionOfData = null
}
},
backPage() {
......@@ -65,7 +65,7 @@ export default {
this.toolComponentName = name
console.log(this.toolComponentName)
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!