Commit 425265c0 by 胡悦

fix(CreateOrder): 修复订单创建逻辑并添加拦截混入

refactor(sprite): 优化图标样式文件结构并移除无用图标
1 parent 0f5a5a93

2.61 MB | W: | H:

2.61 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -46,8 +46,10 @@ import Product from './Product.vue'
import Package from './Package.vue'
import SkuGoods from './SkuGoods.vue'
import { FORM_LIST, popupTypeEnum, payTypeList } from '../contant'
import { interceptionMixin } from '@/mixin/index'
export default {
name: 'CreateOrder',
mixins: [interceptionMixin],
components: {
GlCell,
OrderPopup,
......@@ -82,7 +84,7 @@ export default {
})
return
}
// 编辑和修改订单进入这里
// 新增订单处理
const { paramsData: { customer, customerCoupon, ...rest } } = newVal
......@@ -94,7 +96,7 @@ export default {
Object.assign(this.orderObj, Object.fromEntries(baseFields.map(field => [field, rest[field]])))
// 设置支付类型
this.orderObj.payeeType = rest.selectPayType === '2' ? '1' : '0'
this.orderObj.payeeType = rest.selectPayType == '2' ? '1' : '0'
// 客户信息映射
const customerFields = ['customerName', 'customerSex', 'customerPhone', 'salesType',
......@@ -143,10 +145,10 @@ export default {
]
formUpdates.forEach(([index, field, value]) => updateFormCell(index, field, value))
// 商品回显,在获取商品列表之后
this.goodsList = rest.subOrderList
}
console.log(this.orderObj, 'orderObj')
handleTransactionData(newVal)
}
},
......@@ -155,7 +157,7 @@ export default {
},
data() {
return {
orderCreateType: 'createWithPay', // supplementOrder(补录订单) createWithPay(新增) editWithPay(编辑、修改)
orderCreateType: 'createWithPay', // supplementOrder(补录订单) createWithPay(新增)
formList: utils.deepClone(FORM_LIST),
userInfo: {},
baseConfigData: {},
......@@ -208,8 +210,6 @@ export default {
console.log('mounted', this.orderCreateType)
this.userInfo = uni.$storage.get('userInfo') || {}
this.baseConfigData = uni.$storage.get('mock_data') || {}
const { userInfo } = this
this.initData()
},
methods: {
......@@ -412,81 +412,83 @@ export default {
async submit() {
console.log(this.orderObj)
if (!this.checkRequired()) return
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType']
obj.customer = {
...obj.customer,
...otherCustomer.reduce((acc, key) => {
if (obj[key] !== undefined) {
acc[key] = obj[key]
delete obj[key]
}
return acc
}, {})
}
// 将 frontGear、frontWindow、rearGear、rearWindow、sunRoof 字段合并到 goodsList 中
const labelFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof', 'package', 'skuGoods']
let goodsList = []
let subGoodsList = []
labelFields.forEach(field => {
if (Array.isArray(obj[field]) && obj[field].length > 0) {
goodsList = goodsList.concat(obj[field])
if (!await this.checkDailyReport()) {
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType']
obj.customer = {
...obj.customer,
...otherCustomer.reduce((acc, key) => {
if (obj[key] !== undefined) {
acc[key] = obj[key]
delete obj[key]
}
return acc
}, {})
}
delete obj[field]
})
if (goodsList.length > 0) {
goodsList.map(e => {
if (e.goodsFlag == 1) {
// 单商品
subGoodsList.push({
totalPrice: e.goods.sellPrice,
number: e.goods.number,
merchantGoodsId: e.goods.merchantGoodsId
})
// 将 frontGear、frontWindow、rearGear、rearWindow、sunRoof 字段合并到 goodsList 中
const labelFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof', 'package', 'skuGoods']
let goodsList = []
let subGoodsList = []
labelFields.forEach(field => {
if (Array.isArray(obj[field]) && obj[field].length > 0) {
goodsList = goodsList.concat(obj[field])
}
// 套餐
if (e.goodsFlag == 3) {
e.packageGoods.goodsList.forEach(g => {
delete obj[field]
})
if (goodsList.length > 0) {
goodsList.map(e => {
if (e.goodsFlag == 1) {
// 单商品
subGoodsList.push({
packageCode: e.packageGoods.packageCode,
packageName: e.packageGoods.packageName,
totalPrice: g.sellPrice,
number: e.packageGoods.number,
merchantGoodsId: g.merchantGoodsId,
upgradePrice: g.oldPrice
totalPrice: e.goods.sellPrice,
number: e.goods.number,
merchantGoodsId: e.goods.merchantGoodsId
})
})
}
// 多规格
if (e.goodsFlag == 2) {
subGoodsList.push({
baseGoodsId: e.multipleSpecificationsGoods.goods.baseGoodsId,
totalPrice: Number(e.multipleSpecificationsGoods.goods.sellPrice),
number: e.multipleSpecificationsGoods.number,
merchantGoodsId: e.multipleSpecificationsGoods.goods.id || e.multipleSpecificationsGoods.goods.merchantGoodsId
})
}
})
obj.subOrderList = subGoodsList
}
delete obj.carBrand
delete obj.couponInfo
console.log(obj, 'rucan')
}
// 套餐
if (e.goodsFlag == 3) {
e.packageGoods.goodsList.forEach(g => {
subGoodsList.push({
packageCode: e.packageGoods.packageCode,
packageName: e.packageGoods.packageName,
totalPrice: g.sellPrice,
number: e.packageGoods.number,
merchantGoodsId: g.merchantGoodsId,
upgradePrice: g.oldPrice
})
})
}
// 多规格
if (e.goodsFlag == 2) {
subGoodsList.push({
baseGoodsId: e.multipleSpecificationsGoods.goods.baseGoodsId,
totalPrice: Number(e.multipleSpecificationsGoods.goods.sellPrice),
number: e.multipleSpecificationsGoods.number,
merchantGoodsId: e.multipleSpecificationsGoods.goods.id || e.multipleSpecificationsGoods.goods.merchantGoodsId
})
}
})
obj.subOrderList = subGoodsList
}
delete obj.carBrand
delete obj.couponInfo
console.log(obj, 'rucan')
uni.showLoading({
title: '提交中...',
mask: true
})
const res = await uni.$api.boutiqueApi[orderCreateType](obj).finally(() => {
uni.hideLoading()
})
if (res) {
uni.showToast({
title: '保存成功',
icon: 'success'
uni.showLoading({
title: '提交中...',
mask: true
})
this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res)
const res = await uni.$api.boutiqueApi[orderCreateType](obj).finally(() => {
uni.hideLoading()
})
if (res) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res)
}
}
},
// 计算所有产品的总价
......@@ -500,6 +502,7 @@ export default {
// 计算每个产品的价格 * 数量,并累加到总价
productList.forEach(item => {
if (item.goods && item.goods.sellPrice && item.goods.number) {
console.log(item.goods, '---单商品')
total += parseFloat(item.goods.sellPrice) * parseInt(item.goods.number)
} else if (item.packageGoods && item.packageGoods.upgradePrice && item.packageGoods.number) {
console.log(item.packageGoods, '套餐')
......@@ -511,8 +514,9 @@ export default {
item.packageGoods.goodsList.forEach(i => {
total += parseFloat(i.sellPrice) * parseInt(item.packageGoods.number)
})
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods && item.multipleSpecificationsGoods.goods.sellPrice && item.multipleSpecificationsGoods.number) {
total += parseFloat(item.multipleSpecificationsGoods.goods.sellPrice) * parseInt(item.multipleSpecificationsGoods.number)
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods && item.multipleSpecificationsGoods.goods.sellPrice) {
console.log(item.multipleSpecificationsGoods, '多规格')
total += parseFloat(item.multipleSpecificationsGoods.goods.sellPrice) * parseInt(item.multipleSpecificationsGoods.number||1)
}
})
}
......@@ -527,9 +531,14 @@ export default {
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, '上一个订单的销售顾问信息')
console.log(this.orderObj.merchantId)
if (this.orderObj.merchantId == res.merchantId) {
this.$set(this.orderObj, 'employeeName', res.employeeName)
this.orderObj.userId = res.userId
console.log(res, '上一个订单的销售顾问信息')
} else {
this.getEmployeeList()
}
},
async getShopMerchantPointConfig(merchantId) {
const res = await uni.$api.boutiqueApi.getShopMerchantPointConfig({ merchantId })
......@@ -631,8 +640,8 @@ export default {
})
if (data && data.length) {
this.employeeList = data
// this.$set(this.orderObj, 'employeeName', data[0].staffName)
// this.orderObj.userId = data[0].uuid
this.$set(this.orderObj, 'employeeName', data[0].staffName)
this.orderObj.userId = data[0].uuid
}
},
async getPositionList() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!