|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="y-container">
|
|
<div class="y-container">
|
|
|
- <prodTemp ref="prod" :columns="utils.TBLayout('modelProductTable')" :param="param" :hideBorder="true" @onSelect="onProdSelect">
|
|
|
|
|
|
|
+ <prodTemp ref="prod" rowKey="rowindex" :columns="utils.TBLayout('modelProductTable')" :param="param" :hideBorder="true" @onSelect="onProdSelect">
|
|
|
<template #operation>
|
|
<template #operation>
|
|
|
<a-input class="search-input" v-model:value="search" @keyup.enter="onSearch" placeholder="搜索商品"></a-input>
|
|
<a-input class="search-input" v-model:value="search" @keyup.enter="onSearch" placeholder="搜索商品"></a-input>
|
|
|
</template>
|
|
</template>
|
|
@@ -31,7 +31,11 @@
|
|
|
<template v-if="data.column.dataIndex == 'groupqty'">
|
|
<template v-if="data.column.dataIndex == 'groupqty'">
|
|
|
<span>{{data.record.islimit == 0?'不限购':data.record.groupqty == '0'?'不限购':data.record.groupqty == data.record.saledqty?'已售罄':data.record.groupqty - data.record.saledqty}}</span>
|
|
<span>{{data.record.islimit == 0?'不限购':data.record.groupqty == '0'?'不限购':data.record.groupqty == data.record.saledqty?'已售罄':data.record.groupqty - data.record.saledqty}}</span>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
|
|
|
|
|
|
|
+ <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 v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
|
|
|
<a-select v-if="data.record.lengthschemeid != 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
|
|
<a-select v-if="data.record.lengthschemeid != 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
|
|
|
<a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
<a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
@@ -44,24 +48,70 @@
|
|
|
</a-select>
|
|
</a-select>
|
|
|
<a-input v-else style="width:200px;" v-model:value="data.record.width" :placeholder="`${data.record.widthmin}-${data.record.widthmax}`" @blur="validInput(data.record,data.record.widthmin,data.record.widthmax,'width')">
|
|
<a-input v-else style="width:200px;" v-model:value="data.record.width" :placeholder="`${data.record.widthmin}-${data.record.widthmax}`" @blur="validInput(data.record,data.record.widthmin,data.record.widthmax,'width')">
|
|
|
</a-input>
|
|
</a-input>
|
|
|
- </template>
|
|
|
|
|
|
|
+ </template> -->
|
|
|
</template>
|
|
</template>
|
|
|
</prodTemp>
|
|
</prodTemp>
|
|
|
<div class="submit-panel">
|
|
<div class="submit-panel">
|
|
|
- <a-button @click="addCart" :disabled="selectProd.length == 0">加入活动购物车</a-button> 
|
|
|
|
|
|
|
+ <a-button @click="checkProdsAllowed('shopcart')" :disabled="selectProd.length == 0">加入活动购物车</a-button> 
|
|
|
<a-badge :count="cartCount">
|
|
<a-badge :count="cartCount">
|
|
|
<a-button @click="toShopCart" type="primary">活动购物车</a-button>
|
|
<a-button @click="toShopCart" type="primary">活动购物车</a-button>
|
|
|
</a-badge>
|
|
</a-badge>
|
|
|
<p><span style="margin-right:20px">当前选中了<b class="color-red"> {{selectProd.length}} </b>条商品</span></p>
|
|
<p><span style="margin-right:20px">当前选中了<b class="color-red"> {{selectProd.length}} </b>条商品</span></p>
|
|
|
- <div class="submit-btn" @click="onSubmit">创建订单</div>
|
|
|
|
|
|
|
+ <div class="submit-btn" @click="checkProdsAllowed('order')">创建订单</div>
|
|
|
</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>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import Api from '@/api/api'
|
|
import Api from '@/api/api'
|
|
|
import utils from '@/utils/utils'
|
|
import utils from '@/utils/utils'
|
|
|
- import prodTemp from '@/template/billProductTable/index.vue'
|
|
|
|
|
|
|
+ import prodTemp from '@/template/normalTable/index.vue'
|
|
|
import {ref,onMounted,computed,createVNode,onActivated,watch} from 'vue'
|
|
import {ref,onMounted,computed,createVNode,onActivated,watch} from 'vue'
|
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
|
import { Modal } from 'ant-design-vue';
|
|
import { Modal } from 'ant-design-vue';
|
|
@@ -135,7 +185,7 @@
|
|
|
})
|
|
})
|
|
|
return bool
|
|
return bool
|
|
|
}
|
|
}
|
|
|
- const onSubmit = ()=> {
|
|
|
|
|
|
|
+ const onSubmit = (data)=> {
|
|
|
if (!checkIscustomsize()) {
|
|
if (!checkIscustomsize()) {
|
|
|
return false
|
|
return false
|
|
|
} else {
|
|
} else {
|
|
@@ -156,17 +206,7 @@
|
|
|
"type":'促销订单',
|
|
"type":'促销订单',
|
|
|
"tradefield":selectProd.value[0].tradefield[0].tradefield,
|
|
"tradefield":selectProd.value[0].tradefield[0].tradefield,
|
|
|
"sa_promotionid":router.currentRoute.value.query.id,
|
|
"sa_promotionid":router.currentRoute.value.query.id,
|
|
|
- "items":selectProd.value.map(e=>{
|
|
|
|
|
- return {
|
|
|
|
|
- sa_promotion_itemsid:e.sa_promotion_itemsid,
|
|
|
|
|
- itemid:e.itemid,
|
|
|
|
|
- sa_orderitemsid:0,
|
|
|
|
|
- signaturecode:e.signaturecode,
|
|
|
|
|
- length:e.length,
|
|
|
|
|
- width:e.width,
|
|
|
|
|
- qty:e.qty,
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ "items":data
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
utils.message(res,'提交成功',()=>{
|
|
utils.message(res,'提交成功',()=>{
|
|
@@ -195,27 +235,71 @@
|
|
|
})
|
|
})
|
|
|
return bool
|
|
return bool
|
|
|
}
|
|
}
|
|
|
- const addCart = async ()=> {
|
|
|
|
|
|
|
+ const checkProdsAllowed = async (type) =>{
|
|
|
|
|
+ const allowAdd = (e)=>{
|
|
|
|
|
+ if (e.iscustomsize == 1) {
|
|
|
|
|
+ console.log(!e.length || !e.width)
|
|
|
|
|
+ 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,
|
|
|
|
|
+ itemno:e.itemno,
|
|
|
|
|
+ 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_promotion_itemsid:e.sa_promotion_itemsid,
|
|
|
|
|
+ signaturecode:e.signaturecode,
|
|
|
|
|
+ sa_promotionid:router.currentRoute.value.query.id,
|
|
|
|
|
+ tradefield: e.tradefield[0].tradefield,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ sa_orderitemsid:0,
|
|
|
|
|
+ itemid:e.itemid,
|
|
|
|
|
+ itemno:e.itemno,
|
|
|
|
|
+ qty:e.qty,
|
|
|
|
|
+ length:0,
|
|
|
|
|
+ width:0,
|
|
|
|
|
+ sa_brandid: e.sa_brandid,
|
|
|
|
|
+ sa_promotion_itemsid:e.sa_promotion_itemsid,
|
|
|
|
|
+ signaturecode:e.signaturecode,
|
|
|
|
|
+ sa_promotionid:router.currentRoute.value.query.id,
|
|
|
|
|
+ tradefield: e.tradefield[0].tradefield,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(selectProd.value)
|
|
|
|
|
+ let data = selectProd.value.map(e=>{
|
|
|
|
|
+ console.log(e)
|
|
|
|
|
+ return allowAdd(e)
|
|
|
|
|
+ })
|
|
|
|
|
+ if (type == 'order') {
|
|
|
|
|
+ data.filter(e=>e !== undefined).length > 0 ? onSubmit(data.filter(e=>e !== undefined)):''
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data.filter(e=>e !== undefined).length > 0 ? addCart(data.filter(e=>e !== undefined)):''
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ const addCart = async (data)=> {
|
|
|
if (!checkCanAddShopCart()) return false
|
|
if (!checkCanAddShopCart()) return false
|
|
|
let res = await Api.requested({
|
|
let res = await Api.requested({
|
|
|
"id": 20231024110003,
|
|
"id": 20231024110003,
|
|
|
"content": {
|
|
"content": {
|
|
|
- // "sa_brandid":,
|
|
|
|
|
"sa_promotionid":router.currentRoute.value.query.id,
|
|
"sa_promotionid":router.currentRoute.value.query.id,
|
|
|
- "items":prod.value.tableRecord.map(item=>{
|
|
|
|
|
- return {
|
|
|
|
|
- "sa_promotionid":router.currentRoute.value.query.id,
|
|
|
|
|
- "sa_brandid":router.currentRoute.value.query.brandid,
|
|
|
|
|
- "itemid": item.itemid, //货品id
|
|
|
|
|
- "qty": item.qty, //数量
|
|
|
|
|
- "itemno":item.itemno, //货品编号
|
|
|
|
|
- "tradefield": item.tradefield[0].tradefield,
|
|
|
|
|
- "signaturecode":item.signaturecode,
|
|
|
|
|
- "length":item.length ? item.length : 0,
|
|
|
|
|
- "width":item.width ? item.width: 0,
|
|
|
|
|
- "sa_promotion_itemsid":item.sa_promotion_itemsid,
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ "items":data
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
utils.message(res,'添加成功',()=>{
|
|
utils.message(res,'添加成功',()=>{
|
|
@@ -236,6 +320,51 @@
|
|
|
})
|
|
})
|
|
|
cartCount.value = res.data.num
|
|
cartCount.value = res.data.num
|
|
|
}
|
|
}
|
|
|
|
|
+ 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
|
|
|
|
|
+ }
|
|
|
|
|
+ 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(()=>{
|
|
onActivated(()=>{
|
|
|
prod.value.reloadSelect()
|
|
prod.value.reloadSelect()
|
|
|
})
|
|
})
|
|
@@ -296,4 +425,11 @@
|
|
|
font-size: 1.5em;
|
|
font-size: 1.5em;
|
|
|
margin-left:10px;
|
|
margin-left:10px;
|
|
|
}
|
|
}
|
|
|
|
|
+ .label{
|
|
|
|
|
+ display:inline-block;
|
|
|
|
|
+ margin-right:10px
|
|
|
|
|
+ }
|
|
|
|
|
+ .mt-10{
|
|
|
|
|
+ margin-bottom:20px
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|