浏览代码

发货经销商

chenrui 6 月之前
父节点
当前提交
31ed9455f9

+ 95 - 0
src/views/salesManagement/salesQueryNew/auditModal.vue

@@ -0,0 +1,95 @@
+<template>
+  <a-modal
+    centered
+    :footer="null"
+    :maskClosable="false"
+    class="audit-modal"
+    :title="modalTit"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="550">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="audit-modal-form"
+        ref="ruleForm"
+        :model="detailData"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-form-model-item>
+        <a-form-model-item label="发货经销商">
+          {{ detailData&&detailData.transferDealerName||'--' }}
+        </a-form-model-item>
+        <div style="margin:20px auto;width:80%;">由于<strong style="color:#ed1c24;">{{ detailData&&detailData.transferDealerName }}</strong>非<strong style="color:#ed1c24;">{{ detailData&&detailData.buyerName }}</strong>的轮胎上级或省仓,需上级审核通过后完成转单。</div>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button id="audit-modal-back" @click="handleSave('0')">审核不通过</a-button>
+        <a-button type="primary" style="margin-left: 15px;" id="audit-modal-save" @click="handleSave('1')">审核通过</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+export default {
+  name: 'AuditConfirmModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    detailData: {
+      type: Object,
+      default: () => {
+        return null
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      spinning: false
+    }
+  },
+  computed: {
+    modalTit () {
+      const title = (this.detailData && this.detailData.transferDate) ? '(' + this.detailData.transferDate + ')' : ''
+      return '转单申请' + title
+    }
+  },
+  methods: {
+    // 确认审核
+    handleSave (val) {
+      this.$emit('ok', val)
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .audit-modal{
+    .ant-form-item{
+      margin-bottom: 10px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 40px 0 10px;
+    }
+  }
+</style>

+ 140 - 0
src/views/salesManagement/salesQueryNew/comps/dealerStockModal.vue

@@ -0,0 +1,140 @@
+<template>
+  <a-modal
+    v-model="isShow"
+    title="选择发货经销商"
+    centered
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    width="500px"
+    :footer="null"
+    @cancel="cancel">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div style="padding: 0 30px;">
+        <a-radio-group v-model="chooseVal">
+          <!-- SUPERIORS 上级 purchase  省仓 -->
+          <a-radio :style="radioStyle" v-for="(item,index) in dealerList" :key="item.dealerSn" :value="item.dealerSn">
+            {{ item.dealerName }}{{ item.parentType?item.parentType==='SUPERIORS'?'(上级)':'(省仓)' :'' }}
+            <dealerSubareaScopeList
+              v-if="index==dealerList.length-1&&chooseVal=='a1'"
+              dealertype="tire"
+              placeholder="请输入发货经销商名称"
+              ref="dealerSubareaScopeList"
+              id="dealerStockModal-custList"
+              style="margin-left:10px;width:280px;"
+              @change="dealerChange" />
+          </a-radio>
+        </a-radio-group>
+      </div>
+      <div style="padding: 30px 0 0;text-align: center;">
+        <a-button @click="cancel" style="margin-right: 15px" type="default" id="chooseCustom-btn-back">取消</a-button>
+        <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { querySuperiorDealer, queryTransferDealerStock } from '@/api/sales'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+export default {
+  name: 'DealerStockModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: String,
+      default: ''
+    }
+  },
+  components: { dealerSubareaScopeList },
+  data () {
+    return {
+      isShow: this.openModal,
+      spinning: false,
+      confirmLoading: false,
+      chooseVal: null,
+      radioStyle: "display:block;height: '30px';lineHeight: '30px';padding:5px 0;",
+      dealerList: [{ dealerName: '其他经销商', dealerSn: 'a1' }],
+      salesBillSn: null,
+      selectDealerSn: undefined, // 已选发货经销商
+      selectDealerName: undefined
+    }
+  },
+  methods: {
+    getDealerList () {
+      this.spinning = true
+      querySuperiorDealer({ salesBillSn: this.itemSn }).then(res => {
+        this.dealerList = res.data.concat(this.dealerList)
+        // 默认选中第一项
+        this.chooseVal = this.dealerList[0].dealerSn
+        this.spinning = false
+      })
+    },
+    // 选择经销商
+    dealerChange (val) {
+      if (val && val.key) {
+        this.selectDealerSn = val.key
+        this.selectDealerName = val.name
+      }
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      let chooseRow = []
+      if (_this.chooseVal) {
+        if (_this.chooseVal === 'a1') {
+          if (!_this.selectDealerSn || !_this.selectDealerName) {
+            _this.$message.warning('请选择发货经销商!')
+            return
+          }
+          chooseRow.push({
+            dealerSn: _this.selectDealerSn,
+            dealerName: _this.selectDealerName
+          })
+        } else {
+          chooseRow = _this.dealerList.filter(item => item.dealerSn == _this.chooseVal)
+        }
+        _this.confirmLoading = true
+        queryTransferDealerStock({ salesBillSn: _this.itemSn, transferDealerSn: _this.chooseVal === 'a1' ? _this.selectDealerSn : _this.chooseVal }).then(res => {
+          if (res.status == 200) {
+            _this.confirmLoading = false
+            _this.cancel()
+            _this.$emit('ok', chooseRow[0], res.data)
+          }
+        })
+      } else {
+        _this.$message.info('请选择发货经销商类型!')
+      }
+    },
+    cancel () {
+      this.dealerList = [{ dealerName: '其他经销商', dealerSn: 'a1' }]
+      if (this.$refs && Object.keys(this.$refs).length && this.chooseVal == 'a1') {
+        this.$refs.dealerSubareaScopeList[0].resetForm()
+      }
+      this.chooseVal = null
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        if (this.itemSn && this.itemSn.length > 0) {
+          this.getDealerList()
+        }
+      }
+    }
+  }
+}
+</script>