|
@@ -0,0 +1,120 @@
|
|
|
+<template>
|
|
|
+ <a-modal
|
|
|
+ centered
|
|
|
+ :footer="null"
|
|
|
+ :maskClosable="false"
|
|
|
+ title="促销品列表"
|
|
|
+ v-model="isShow"
|
|
|
+ @cancle="cansel"
|
|
|
+ width="80%">
|
|
|
+ <a-card size="small" :bordered="false" class="productInfoList-wrap">
|
|
|
+ <!-- 列表 -->
|
|
|
+ <a-table
|
|
|
+ class="sTable"
|
|
|
+ ref="table"
|
|
|
+ size="small"
|
|
|
+ :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="list"
|
|
|
+ :loading="loading"
|
|
|
+ :scroll="{ y: 350 }"
|
|
|
+ bordered>
|
|
|
+ <!-- 销售数量 -->
|
|
|
+ <template slot="salesNums" slot-scope="text, record">
|
|
|
+ <a-input-number
|
|
|
+ size="small"
|
|
|
+ :max="999999"
|
|
|
+ :min="1"
|
|
|
+ v-model="record.qty"
|
|
|
+ :precision="0"
|
|
|
+ :step="1"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ <div style="display: flex;justify-content: center;padding: 10px 0;">
|
|
|
+ <a-button size="large" type="primary" class="button-primary" @click="handleSubmit" style="padding: 0 60px;">
|
|
|
+ 确定
|
|
|
+ </a-button>
|
|
|
+ <a-button size="large" style="padding: 0 60px;margin-left: 15px;font-size: 12px;" @click="cansel">
|
|
|
+ 取消
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
+ </a-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import { getPromoGoodsList } from '@/api/salesDetail'
|
|
|
+export default {
|
|
|
+ name: 'ChooseProduct',
|
|
|
+ components: { STable, VSelect },
|
|
|
+ props: {
|
|
|
+ openModal: { // 弹框显示状态
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ isShow: this.openModal,
|
|
|
+ columns: [
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '成本价', dataIndex: 'showCost', align: 'center', ellipsis: true, customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
+ { title: '原售价', dataIndex: 'origPrice', align: 'center', ellipsis: true, customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
+ { title: '促销价', dataIndex: 'price', align: 'center', ellipsis: true, customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
+ { title: '数量', dataIndex: 'qty', scopedSlots: { customRender: 'salesNums' }, align: 'center' },
|
|
|
+ { title: '单位', dataIndex: 'productEntity.unit', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '促销类型', dataIndex: 'promotionSourceSn', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } }
|
|
|
+ ],
|
|
|
+ selectedRowKeys: [], // Check here to configure the default column
|
|
|
+ selectedRows: [],
|
|
|
+ loading: false,
|
|
|
+ list: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getData (row) {
|
|
|
+ this.loading = true
|
|
|
+ getPromoGoodsList({ salesBillDetailSn: row.salesBillDetailSn }).then(res => {
|
|
|
+ this.list = res.data.list
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSelectChange (selectedRowKeys, selectedRows) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ this.selectedRows = selectedRows
|
|
|
+ },
|
|
|
+ // 选择产品
|
|
|
+ handleSubmit () {
|
|
|
+ const _this = this
|
|
|
+ if (_this.selectedRowKeys.length < 1) {
|
|
|
+ _this.$message.warning('请选择促销品!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const obj = []
|
|
|
+ _this.selectedRows.map(item => {
|
|
|
+ obj.push(item.productSn)
|
|
|
+ })
|
|
|
+ _this.$emit('ok', obj)
|
|
|
+ },
|
|
|
+ cansel () {
|
|
|
+ this.$emit('close')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 父页面传过来的弹框状态
|
|
|
+ openModal (newValue, oldValue) {
|
|
|
+ this.isShow = newValue
|
|
|
+ },
|
|
|
+ // 重定义的弹框状态
|
|
|
+ isShow (newValue, oldValue) {
|
|
|
+ if (!newValue) {
|
|
|
+ this.$emit('close')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|