|
@@ -74,10 +74,8 @@
|
|
|
bordered>
|
|
|
<!-- 产品名称 -->
|
|
|
<template slot="productName" slot-scope="text, record">
|
|
|
- <a-badge count="活动" v-if="record.promotableFlag == 1">
|
|
|
- <div style="padding-right: 15px;">{{ text }}</div>
|
|
|
- </a-badge>
|
|
|
- <span v-else>{{ text }}</span>
|
|
|
+ <span>{{ text }}</span>
|
|
|
+ <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.promotableFlag == 1"></a-badge>
|
|
|
</template>
|
|
|
|
|
|
<!-- 销售数量 -->
|
|
@@ -105,10 +103,32 @@
|
|
|
:loading="delLoading"
|
|
|
class="button-warning"
|
|
|
@click="handleSelCx(record)"
|
|
|
+ v-if="record.promotableFlag == 1"
|
|
|
>选择促销品</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
|
+ <a-card :bordered="false" class="salesEdit-cont">
|
|
|
+ <div slot="title">
|
|
|
+ <div class="p-title">
|
|
|
+ 已选促销品
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 总计 -->
|
|
|
+ <a-alert type="info">
|
|
|
+ <div slot="message" class="total-bar">
|
|
|
+ <div>
|
|
|
+ 总成本:<strong>¥{{ detailData&&detailData.totalPromoCost || 0 }}</strong>;
|
|
|
+ 总款数:<strong>{{ detailData&&detailData.totalPromoCategory || 0 }}</strong>;
|
|
|
+ 总数量:<strong>{{ detailData&&detailData.totalPromoQty || 0 }}</strong>;
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-alert>
|
|
|
+ <!-- 已选促销品列表 -->
|
|
|
+ <queryPromotable ref="promotable" :salesBillSn="$route.params.sn" @onCellChange="onCellChange" @del="handleDel"></queryPromotable>
|
|
|
+ </a-card>
|
|
|
<a-affix :offset-bottom="0">
|
|
|
<div
|
|
|
style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
|
|
@@ -124,21 +144,27 @@
|
|
|
<!-- 选择客户弹框 -->
|
|
|
<choose-custom-modal ref="custModal" :show="openModal" @cancel="openModal=false" />
|
|
|
<!-- 添加产品 -->
|
|
|
- <ChooseActive ref="activeProduct" :openModal="newActive" @ok="addNewActive" @close="newActive=false"></ChooseActive>
|
|
|
+ <ChooseActive
|
|
|
+ ref="activeProduct"
|
|
|
+ :buyerSn="detailData&&detailData.buyerSn"
|
|
|
+ :openModal="newActive"
|
|
|
+ @ok="addNewActive"
|
|
|
+ @close="newActive=false"></ChooseActive>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
+import queryPromotable from './queryPromotable.vue'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
import ChooseActive from './chooseActive.vue'
|
|
|
import { salesDetailBySn, salesWriteSubmit, getPromoacActiveList } from '@/api/sales'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
-import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
|
|
|
+import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, addPromoGoods } from '@/api/salesDetail'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
- components: { STable, VSelect, queryPart, chooseCustomModal, EditableCell, ChooseActive },
|
|
|
+ components: { STable, VSelect, queryPart, queryPromotable, chooseCustomModal, EditableCell, ChooseActive },
|
|
|
data () {
|
|
|
return {
|
|
|
salesBillSn: null, // 销售单sn
|
|
@@ -150,7 +176,8 @@ export default {
|
|
|
detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
|
|
|
dataSource: [],
|
|
|
productForm: {
|
|
|
- salesBillSn: ''
|
|
|
+ salesBillSn: '',
|
|
|
+ promotionFlag: 0
|
|
|
},
|
|
|
activeList: [], // 促销活动
|
|
|
// 表头
|
|
@@ -197,8 +224,8 @@ export default {
|
|
|
salesBillSn: this.salesBillSn
|
|
|
}).then(res => {
|
|
|
this.resetSearchForm(true)
|
|
|
+ this.$refs.promotable.resetCurForm()
|
|
|
if (res.status == 200) {
|
|
|
- this.$refs.partQuery.resetCurForm()
|
|
|
this.$message.success(res.message)
|
|
|
}
|
|
|
})
|
|
@@ -214,6 +241,7 @@ export default {
|
|
|
// 重置
|
|
|
resetSearchForm (flag) {
|
|
|
this.$refs.table.refresh(!!flag)
|
|
|
+ this.getPromoacActiveList()
|
|
|
this.getOrderDetail()
|
|
|
},
|
|
|
// 重置列表
|
|
@@ -237,6 +265,7 @@ export default {
|
|
|
salesDetailDelAll({ salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.resetSearchForm()
|
|
|
+ _this.$refs.promotable.resetCurForm()
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
|
_this.delLoading = false
|
|
@@ -257,6 +286,7 @@ export default {
|
|
|
salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.resetSearchForm(true)
|
|
|
+ _this.$refs.promotable.resetCurForm()
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
|
_this.delLoading = false
|
|
@@ -290,12 +320,11 @@ export default {
|
|
|
purchaseBillSn: this.detailData.purchaseBillSn,
|
|
|
purchaseBillNo: this.detailData.purchaseBillNo,
|
|
|
stockSn: row.stockSn,
|
|
|
- promotableFlag: row.promotableFlag || 0, // 可促销标记 有活动的传1,没活动的传0
|
|
|
+ promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
|
|
|
promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.resetSearchForm()
|
|
|
- this.$refs.partQuery.resetCurForm()
|
|
|
this.$message.success('产品添加成功', 2.5)
|
|
|
}
|
|
|
this.isInster = false
|
|
@@ -331,8 +360,22 @@ export default {
|
|
|
this.newActive = true
|
|
|
this.$refs.activeProduct.getData(row)
|
|
|
},
|
|
|
- addNewActive () {
|
|
|
-
|
|
|
+ // 批量添加促销品
|
|
|
+ addNewActive (list) {
|
|
|
+ const temp = []
|
|
|
+ list.map(item => {
|
|
|
+ temp.push(Object.assign(item, {
|
|
|
+ salesBillSn: this.detailData.salesBillSn,
|
|
|
+ salesBillNo: this.detailData.salesBillNo,
|
|
|
+ purchaseBillSn: this.detailData.purchaseBillSn,
|
|
|
+ purchaseBillNo: this.detailData.purchaseBillNo
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ addPromoGoods(temp).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$refs.promotable.getData()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
@@ -341,7 +384,10 @@ export default {
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
vm.salesBillSn = vm.$route.params.sn
|
|
|
+ // 获取促销活动
|
|
|
vm.getPromoacActiveList()
|
|
|
+ // 查询已选促销品
|
|
|
+ vm.$refs.promotable.getData()
|
|
|
})
|
|
|
}
|
|
|
}
|