|
|
@@ -18,14 +18,64 @@
|
|
|
</template>
|
|
|
<template v-if="data.column.dataIndex == 'amount'">
|
|
|
<span class="color-red">¥ {{utils.formatAmount(data.record.qty * data.record.gradeprice)}}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="data.column.dataIndex === 'iscustom' && data.record.iscustomsize == 1">
|
|
|
+ <a-button type="link" @click="openCustom(data)" v-if="!data.record.isselect">定制信息</a-button>
|
|
|
+ <a-tag v-else closable @close="closeInfo(data.record)">{{ infoFun(data.record) }}</a-tag>
|
|
|
</template>
|
|
|
</template>
|
|
|
</prod-temp>
|
|
|
<div class="submit-panel">
|
|
|
<a-button style="margin-left:10px" type="default" :disabled="selectProd.length === 0" @click="deleteProd">删除当前选中商品</a-button>
|
|
|
<p><span style="margin-right:20px">当前选中了<b class="color-red"> {{selectProd.length}} </b>条商品</span>合计:<b class="color-red sumAmount">{{utils.formatAmount(sum)}}</b></p>
|
|
|
- <div class="submit-btn" @click="onSubmit">创建订单</div>
|
|
|
+ <div class="submit-btn" @click="checkProdsAllowed">创建订单</div>
|
|
|
</div>
|
|
|
+ <a-modal v-model:open="open" wrapClassName="oder-modal" title="定制信息" @ok="handleOk" style="text-align:left" :closable="false">
|
|
|
+ <div class="mt-10" style="display: flex;justify-content: space-evenly;margin-top: 20px;">
|
|
|
+ <div style="display: flex;align-items: center;color: red;">
|
|
|
+ <span class="label">品号:{{prodData.record.itemno}}</span>
|
|
|
+ <span class="label overflow" style="max-width: 220px;margin-left: 10px;">品名:
|
|
|
+ <a-tooltip placement="topLeft" :title="prodData.record.itemname" arrow-point-at-center>
|
|
|
+ {{prodData.record.itemname}}
|
|
|
+ </a-tooltip>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mt-10" v-if="prodData.record.cheekschemeid > 0">
|
|
|
+ <span class="label">工艺</span>
|
|
|
+ <a-select v-model:value="prodData.record.customcheek" style="width: 400px;" placeholder="选择工艺">
|
|
|
+ <a-select-option v-for="item in prodData.record.cheekschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ <div class="mt-10" v-if="prodData.record.colorschemeid > 0">
|
|
|
+ <span class="label">颜色</span>
|
|
|
+ <a-select v-model:value="prodData.record.customcolors" style="width: 400px" placeholder="选择颜色">
|
|
|
+ <a-select-option v-for="item in prodData.record.colorsschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ <div class="mt-10" v-if="prodData.record.materialschemeid > 0">
|
|
|
+ <span class="label">选项</span>
|
|
|
+ <a-select v-model:value="prodData.record.custommaterial" style="width: 400px" placeholder="选择选项">
|
|
|
+ <a-select-option v-for="item in prodData.record.materialschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ <div class="mt-10" v-if="prodData.record.spec == '自定义' || prodData.record.spec == 'custom'">
|
|
|
+ <span class="label">长度</span>
|
|
|
+ <a-select v-if="prodData.record.lengthschemedetails.length > 0" v-model:value="prodData.record.length" style="width: 400px" placeholder="选择长度">
|
|
|
+ <a-select-option v-for="item in prodData.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ <a-input v-else style="width:400px;" v-model:value="prodData.record.length" :placeholder="`输入${prodData.record.lengthmin}到${prodData.record.lengthmax}毫米`" @blur="validInput(prodData.record,prodData.record.lengthmin,prodData.record.lengthmax,'length')">
|
|
|
+ </a-input>
|
|
|
+ </div>
|
|
|
+ <div class="mt-10" v-if="prodData.record.spec == '自定义' || prodData.record.spec == 'custom'">
|
|
|
+ <span class="label">宽度</span>
|
|
|
+ <a-select v-if="prodData.record.widthschemedetails.length > 0" v-model:value="prodData.record.width" style="width: 400px" placeholder="选择宽度">
|
|
|
+ <a-select-option v-for="item in prodData.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ <a-input v-else style="width:400px;" v-model:value="prodData.record.width" :placeholder="`输入${prodData.record.widthmin}到${prodData.record.widthmax}毫米`" @blur="validInput(prodData.record,prodData.record.widthmin,prodData.record.widthmax,'width')">
|
|
|
+ </a-input>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -97,8 +147,49 @@
|
|
|
})
|
|
|
},500)
|
|
|
}
|
|
|
+ const checkProdsAllowed = async (val) =>{
|
|
|
+ const allowAdd = (e)=>{
|
|
|
+ if (e.iscustomsize == 1) {
|
|
|
+ if (!e.length || !e.width) {
|
|
|
+ message.error(e.itemname + '定制信息有误,请检查!')
|
|
|
+ } else if (e.cheekschemeid > 0 && !e.customcheek) {
|
|
|
+ message.error(e.itemname + '工艺定制信息有误,请检查!')
|
|
|
+ } else if (e.colorschemeid > 0 && !e.customcolors) {
|
|
|
+ message.error(e.itemname + '颜色定制信息有误,请检查!')
|
|
|
+ } else if (e.materialschemeid > 0 && !e.custommaterial) {
|
|
|
+ message.error(e.itemname + '选项定制信息有误,请检查!')
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ sa_orderitemsid:0,
|
|
|
+ itemid:e.itemid,
|
|
|
+ qty:e.qty,
|
|
|
+ length:e.length ? e.length:0,
|
|
|
+ width:e.width ? e.width:0,
|
|
|
+ customcolors:e.customcolors ? e.customcolors:0,
|
|
|
+ customcheek:e.customcheek ? e.customcheek:0,
|
|
|
+ custommaterial:e.custommaterial ? e.custommaterial:0,
|
|
|
+ sa_brandid: e.sa_brandid,
|
|
|
+ sa_shoppingcartid:e.sa_shoppingcartid,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ sa_orderitemsid:0,
|
|
|
+ itemid:e.itemid,
|
|
|
+ qty:e.qty,
|
|
|
+ length:0,
|
|
|
+ width:0,
|
|
|
+ sa_brandid: e.sa_brandid,
|
|
|
+ sa_shoppingcartid:e.sa_shoppingcartid,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let data = selectProd.value.map(e=>{
|
|
|
+ return allowAdd(e)
|
|
|
+ })
|
|
|
+ data.filter(e=>e !== undefined).length > 0 ? onSubmit(data.filter(e=>e !== undefined)):''
|
|
|
+ }
|
|
|
const onSubmit = ()=> {
|
|
|
- if (fieldSame.value) return false
|
|
|
if (selectProd.value.length == 0) return message.error('未选择商品无法创建订单')
|
|
|
Modal.confirm({
|
|
|
title:'生成订单',
|
|
|
@@ -163,6 +254,52 @@
|
|
|
})
|
|
|
utils.message(res,'修改成功')
|
|
|
}
|
|
|
+ const open = ref(false)
|
|
|
+ const prodData = ref({})
|
|
|
+ const openCustom = (data)=>{
|
|
|
+ open.value = true
|
|
|
+ prodData.value = data
|
|
|
+ }
|
|
|
+ const handleOk = ()=>{
|
|
|
+ prodData.value.record.isselect = true
|
|
|
+ prod.value.data.some((item)=>{
|
|
|
+ if (item.itemid == prodData.value.itemid) {
|
|
|
+ item = prodData.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ open.value = false
|
|
|
+ onSave(prodData.value.record)
|
|
|
+ }
|
|
|
+ const closeInfo = (data) => {
|
|
|
+ data.isselect = false
|
|
|
+ data.customcheek = null
|
|
|
+ data.customcolors = null
|
|
|
+ data.custommaterial = null
|
|
|
+ data.length = null
|
|
|
+ data.width = null
|
|
|
+ }
|
|
|
+ const infoFun = computed(() => {
|
|
|
+ return (data) => {
|
|
|
+ let customcheek = '',customcolors = '',custommaterial = '',length = '',width = ''
|
|
|
+ if (data.cheekschemeid > 0) customcheek = data.cheekschemedetails.filter(item => item.num == data.customcheek).length ? data.cheekschemedetails.filter(item => item.num == data.customcheek)[0].num : ''
|
|
|
+ if (data.colorschemeid > 0) customcolors = data.colorsschemedetails.filter(item => item.num == data.customcolors).length ? data.colorsschemedetails.filter(item => item.num == data.customcolors)[0].num : ''
|
|
|
+ if (data.materialschemeid > 0) custommaterial = data.materialschemedetails.filter(item => item.num == data.custommaterial).length ? data.materialschemedetails.filter(item => item.num == data.custommaterial)[0].num :''
|
|
|
+ if (data.spec == '自定义' || data.spec == 'custom') {
|
|
|
+ length = data.lengthschemedetails.filter(item => item.num == data.length).length ? data.lengthschemedetails.filter(item => item.num == data.length)[0].num : ''
|
|
|
+ width = data.widthschemedetails.filter(item => item.num == data.width).length ? data.widthschemedetails.filter(item => item.num == data.width)[0].num : ''
|
|
|
+ if (!width) width = data.width
|
|
|
+ if (!length) length = data.length
|
|
|
+ }
|
|
|
+ let result = ''
|
|
|
+ if (customcheek) result = result + customcheek + ','
|
|
|
+ if (customcolors) result = result + customcolors + ','
|
|
|
+ if (custommaterial) result = result + custommaterial + ','
|
|
|
+ if (length) result = result + length + 'x'
|
|
|
+ if (width) result = result + width
|
|
|
+
|
|
|
+ return result
|
|
|
+ }
|
|
|
+ })
|
|
|
onActivated (()=>{
|
|
|
prod.value.listData()
|
|
|
})
|
|
|
@@ -219,4 +356,11 @@
|
|
|
background: #f1f2f3;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+.label{
|
|
|
+ display:inline-block;
|
|
|
+ margin-right:10px
|
|
|
+}
|
|
|
+.mt-10{
|
|
|
+ margin-bottom:20px
|
|
|
+}
|
|
|
</style>
|