lilei il y a 2 ans
Parent
commit
8594d98f28

+ 1 - 1
src/views/salesManagement/salesQuery/detail.vue

@@ -184,7 +184,7 @@
       @ok="auditOrder('AUDIT_PASS')"
       @fail="auditOrder('AUDIT_REJECT')" />
     <!-- 审核加下推 -->
-    <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
+    <dsModal ref="dsModal" title="销售单一键审核" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
   </div>
 </template>
 

+ 41 - 3
src/views/salesManagement/salesQuery/list.vue

@@ -206,6 +206,14 @@
           >
             取消
           </a-button>
+          <a-button
+            size="small"
+            type="link"
+            class="button-warning"
+            :loading="!!tipData"
+            v-if="record.printStatus=='UNABLE_PRINT'"
+            @click="handlePrint(record)"
+          >允许备货打印</a-button>
           <span
             v-if="!(record.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')) &&
               !(record.billStatus == 'WAIT_PUSH'&&$hasPermissions('B_salesDispatch')) &&
@@ -216,6 +224,16 @@
     </a-spin>
     <!-- 选择客户弹框 -->
     <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
+    <!-- 操作提示 -->
+    <commonModal modalTit="操作提示" :openModal="showTipModal" @cancel="canselModal" @ok="updatePrintStatus">
+      <div style="text-align: center;">
+        <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认允许此单进行备货打印吗?</strong></div>
+        <div style="line-height: 24px;">
+          <div>备货单号:{{ tipData&&tipData.dispatchBillNo }}</div>
+          <div>客户名称:{{ tipData&&tipData.buyerName }}</div>
+        </div>
+      </div>
+    </commonModal>
   </a-card>
 </template>
 
@@ -230,7 +248,7 @@ import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import { salesList, salesDel, salesCount } from '@/api/sales'
-import { findBySalesBillSn } from '@/api/dispatch'
+import { findBySalesBillSn, dispatchPrintStatus } from '@/api/dispatch'
 export default {
   name: 'SalesQueryList',
   mixins: [commonMixin],
@@ -241,6 +259,7 @@ export default {
       advanced: false, // 高级搜索 展开/关闭
       disabled: false, //  查询、重置按钮是否可操作
       openModal: false, // 选择客户弹框是否显示
+      showTipModal: false, // 备货打印弹框
       tableHeight: 0,
       time: [
         moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
@@ -299,7 +318,8 @@ export default {
         })
       },
       addrProvinceList: [], //  省下拉
-      showCancelNum: false //  是否显示取消数量和待下推数量
+      showCancelNum: false, //  是否显示取消数量和待下推数量
+      tipData: null // 备货单信息
     }
   },
   computed: {
@@ -320,7 +340,7 @@ export default {
         { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '打印次数', dataIndex: 'detailPrintTimes', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
       ]
       if (this.showCancelNum) {
@@ -392,6 +412,24 @@ export default {
         }
       })
     },
+    // 允许备货打印
+    handlePrint (row) {
+      this.tipData = row
+      this.showTipModal = true
+    },
+    canselModal () {
+      this.tipData = null
+      this.showTipModal = false
+    },
+    updatePrintStatus () {
+      dispatchPrintStatus({ dispatchBillSn: this.tipData.dispatchBillSn, printStatus: 'NO_PRINT' }).then(res => {
+        if (res.status == 200) {
+          this.canselModal()
+          this.$message.info(res.message)
+          this.$refs.table.refresh()
+        }
+      })
+    },
     // 重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate(this.time)

+ 90 - 7
src/views/salesManagement/waitDispatch/dsModal.vue

@@ -4,7 +4,7 @@
     class="dealerAccountEdit-modal"
     :footer="null"
     :maskClosable="false"
-    title="下推销售单"
+    :title="title"
     v-model="isShow"
     @cancel="isShow=false"
     :width="800">
@@ -25,6 +25,12 @@
           <a-form-model-item label="收货客户名称" extra="如果收货客户和下单客户相同,则不需要选择收货客户名称">
             <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
           </a-form-model-item>
+          <a-form-model-item label="收货地址" prop="consigneeTel" v-if="form.receiverSn">
+            <div>
+              {{ chooseAddr }}
+              <a-button type="link" @click="openAddrModal = true">{{ addressVal }} >></a-button>
+            </div>
+          </a-form-model-item>
           <a-form-model-item label="发货编号" prop="sendNo">
             <a-input
               id="dealerAccountEdit-phone"
@@ -52,21 +58,29 @@
           <a-button type="primary" id="dealerAccountEdit-save" @click="handleSave" style="margin-left: 15px;">确定下推</a-button>
         </div>
       </a-spin>
+      <!-- 选择地址 -->
+      <choose-address-modal :openModal="openAddrModal" :paramsData="form.receiverSn" @ok="handleOk" @verify="verifyFun" @close="openAddrModal=false" />
     </div>
   </a-modal>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+import chooseAddressModal from '../salesQuery/receivingAddress/chooseAddressModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import { dealerRecevieAddrQuery } from '@/api/dealerRecevieAddr'
 export default {
   name: 'DsModal',
   mixins: [commonMixin],
-  components: { dealerSubareaScopeList },
+  components: { dealerSubareaScopeList, chooseAddressModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    title: {
+      type: String,
+      default: '下推销售单'
     }
   },
   data () {
@@ -82,13 +96,26 @@ export default {
         printStatus: undefined,
         buyerName: '',
         receiverSn: '',
-        receiverName: ''
+        receiverName: '',
+        shippingAddrProvinceSn: '',
+        shippingAddrProvinceName: '', // 省
+        shippingAddrCitySn: '',
+        shippingAddrCityName: '', // 市
+        shippingAddrCountySn: '',
+        shippingAddrCountyName: '', // 区
+        shippingAddr: '', // 详细地址
+        consigneeTel: '', // 联系电话
+        consigneeName: '' // 联系人名称
       },
       rules: {
         sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
-        printStatus: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
+        printStatus: [{ required: true, message: '请选择备货打印', trigger: 'change' }],
+        consigneeTel: [ { required: true, message: '收货人手机号码不能为空', trigger: ['change', 'blur'] } ]
       },
-      detailData: null //  详情数据
+      detailData: null, //  详情数据
+      addressVal: '选择地址', //  选择地址/更换地址
+      chooseAddr: '', //  当前已选地址信息
+      openAddrModal: false // 选择地址弹框是否显示
     }
   },
   methods: {
@@ -96,9 +123,46 @@ export default {
       this.form.sendNo = i
       this.$refs.ruleForm.validateField('sendNo')
     },
+    // 客户 change
     custChange (val) {
-      this.form.receiverSn = val.key || ''
-      this.form.receiverName = val.name || ''
+      if (val && val.key) {
+        this.form.receiverSn = val.key || undefined
+        this.form.receiverName = val.name || ''
+        this.$refs.ruleForm.clearValidate()
+        this.getDefaultAddress()
+      } else {
+        this.verifyFun(this.addressId)
+      }
+    },
+    // 获取默认地址
+    getDefaultAddress () {
+      dealerRecevieAddrQuery({ defaultFlag: 1, dealerSn: this.form.receiverSn }).then(res => {
+        if (res.status == 200) {
+          if (res.data.length == 1) {
+            const ret = res.data[0]
+            ret.address = (ret.provinceName ? (ret.provinceName + '-') : '') + (ret.cityName ? (ret.cityName + '-') : '') + (ret.countyName ? (ret.countyName + '-') : '') + ret.addr
+            this.addressId = ret.id || undefined
+            this.handleOk(ret)
+          } else {
+            this.verifyFun(this.addressId)
+          }
+        }
+      })
+    },
+    verifyFun (id) {
+      if (id == this.addressId) {
+        this.chooseAddr = ''
+        this.addressVal = '选择地址'
+        this.form.shippingAddrProvinceSn = ''
+        this.form.shippingAddrProvinceName = ''// 省
+        this.form.shippingAddrCitySn = ''
+        this.form.shippingAddrCityName = '' // 市
+        this.form.shippingAddrCountySn = ''
+        this.form.shippingAddrCountyName = '' // 区
+        this.form.shippingAddr = ''// 详细地址
+        this.form.consigneeTel = '' // 联系电话
+        this.form.consigneeName = ''
+      }
     },
     //  保存
     handleSave () {
@@ -113,6 +177,24 @@ export default {
         }
       })
     },
+    //  地址保存
+    handleOk (data) {
+      this.chooseAddr = (data.consigneeName || '') + '(' + (data.consigneeTel || '-') + ')' + ' ' + (data.address || '')
+      this.addressVal = '更换地址'
+      this.form.shippingAddrProvinceSn = data.provinceSn || ''
+      this.form.shippingAddrProvinceName = data.provinceName || '' // 省
+      this.form.shippingAddrCitySn = data.citySn || ''
+      this.form.shippingAddrCityName = data.cityName || '' // 市
+      this.form.shippingAddrCountySn = data.countySn || ''
+      this.form.shippingAddrCountyName = data.countyName || '' // 区
+      this.form.shippingAddr = data.addr || ''// 详细地址
+      this.form.consigneeTel = data.consigneeTel || '' // 联系电话
+      this.form.consigneeName = data.consigneeName || ''
+      this.addressId = data.id || undefined
+      this.openAddrModal = false
+      // 移除表单项的校验结果
+      this.$refs.ruleForm.clearValidate('consigneeTel')
+    },
     //  获取详情
     setDetail (data) {
       this.detailData = data
@@ -129,6 +211,7 @@ export default {
         receiverName: ''
       }
       this.$refs.dealerSubareaScopeList.resetForm()
+      this.verifyFun(this.addressId)
     }
   },
   watch: {