lilei il y a 2 ans
Parent
commit
c517d57bc9

+ 10 - 0
src/api/data.js

@@ -137,4 +137,14 @@ export const getArea = (params) => {
       method: 'post'
     })
   }
+}
+// 查询省/市/区 兼容小程序数据
+export const getAreaCgj = (params) => {
+  if(params.type == '2' || params.parentId){
+    return axios({
+      url: `/areaCgj/queryList`,
+      data: params,
+      method: 'post'
+    })
+  }
 }

+ 23 - 1
src/api/dealer.js

@@ -1,5 +1,5 @@
 import { axios } from '@/utils/request'
-//  经销商 列表 有分页
+//  商户列表 有分页
 export const dealerList = (params) => {
   const url = `/dealer/queryLike/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
@@ -10,3 +10,25 @@ export const dealerList = (params) => {
     method: 'post'
   })
 }
+// 经销商 列表
+export const dealerQueryPageList = (params) => {
+  const url = `/dealer/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 客户查询接口 
+export const customerQueryPageList = (params) => {
+  const url = `/customer/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 102 - 40
src/components/UploadFile/index.vue

@@ -4,11 +4,13 @@
       :action="action"
       :listType="listType"
       :fileList="fileList"
+      :disabled="disabled"
       @preview="handlePreview"
       @change="handleChange"
+      :remove="handleRemove"
       :beforeUpload="beforeUpload"
-      :preview-file="previewFile"
       :data="params"
+      :headers="headers"
       :value="comVal"
     >
       <div v-if="fileList.length < maxNums && listType=='picture-card'">
@@ -19,7 +21,7 @@
         <a-button> <a-icon type="upload" /> {{ upText }} </a-button>
       </div>
     </a-upload>
-    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
+    <a-modal :visible="previewVisible" :footer="null" centered :maskClosable="false" @cancel="handleCancel">
       <video v-if="fileType=='video/mp4'" controls="controls" style="width: 100%" :src="previewImage" />
       <img v-else alt="example" style="width: 100%" :src="previewImage" />
     </a-modal>
@@ -43,9 +45,7 @@ export default {
     },
     previewFile: {
       type: Function,
-      default: function () {
-
-      }
+      default: function () {}
     },
     action: {
       type: String,
@@ -57,7 +57,7 @@ export default {
     },
     upText: {
       type: String,
-      default: '上传'
+      default: ''
     },
     value: {
       type: String
@@ -66,14 +66,21 @@ export default {
       type: Object,
       default: function () {
         return {
-          savePathType: 'ali' // 存储类型 local 服务器本地,ali 阿里云
+          savePathType: 'ali' // 存储类型 local 服务器本地,ali 阿里云, web
         }
       }
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    uploadType: { //  上传类型  img图片;attach附件;import导入
+      type: String,
+      default: 'img'
     }
   },
   watch: {
     value (a, b) {
-      console.log(a, '=--====')
       this.comVal = a || ''
       if (a == undefined) {
         this.fileList = []
@@ -86,26 +93,47 @@ export default {
       previewImage: '',
       fileList: [],
       comVal: this.value,
-      params: this.uploadParams
+      params: this.uploadParams,
+      headers: {
+        'access-token': this.$store.getters.token
+      }
     }
   },
   methods: {
     setFileList (a) {
       const temp = []
       if (a && a.length > 0) {
-        a.split(',').map((item, index) => {
-          if (item) {
-            temp.push({
-              uid: index,
-              name: item,
-              status: 'done',
-              url: item,
-              response: {
-                data: item
-              }
-            })
-          }
-        })
+        if (this.uploadType == 'img' || this.uploadType == 'import') { // 图片/导入
+          a.split(',').map((item, index) => {
+            if (item) {
+              temp.push({
+                uid: index,
+                name: item,
+                status: 'done',
+                url: item,
+                response: {
+                  data: item
+                }
+              })
+            }
+          })
+        } else if (this.uploadType == 'attach') { // 附件
+          a.map((item, index) => {
+            if (item) {
+              const arr = []
+              arr.push(item) //  包裹成与新上传文件数据返回结构一致
+              temp.push({
+                uid: index,
+                name: item.fileName,
+                status: 'done',
+                url: item.filePath,
+                response: {
+                  data: arr
+                }
+              })
+            }
+          })
+        }
       }
       this.fileList = temp
     },
@@ -116,39 +144,59 @@ export default {
       if (this.listType == 'text') {
         return
       }
-      console.log(file, '8888888888')
       this.previewImage = file.url || file.thumbUrl
-      // this.previewImage = file.response.data
       this.previewVisible = true
     },
+    handleRemove (file) {
+      this.$emit('remove')
+    },
     handleChange ({ file, fileList }) {
-      if (file.status == 'error') {
-        this.$message.error('上传失败,请重试!')
-        return
+      if (file.response && (file.response.status == 500 || file.response.status == 900)) {
+        if (file.status == 'error' || file.status == 'done') {
+          this.$message.error(file.response.message || '上传失败,请重试!')
+          this.$emit('remove')
+          return
+        }
       }
       this.fileList = this.validaFile(file, fileList)
       this.$emit('change', this.formatFile())
+      this.$emit('input', this.formatFile())
     },
     // 格式化文件列表数据,给表单
     formatFile () {
+      const _this = this
       const a = this.fileList
-      const temp = []
+      let temp = []
+      let obj = null
       if (a && a.length) {
-        a.map(item => {
-          if (item.response && item.status == 'done') {
-            temp.push(item.response.data)
-          }
-        })
+        if (this.uploadType == 'img' || this.uploadType == 'import') { // 图片/导入    将接口的返回图片地址逗号拼接后返回页面
+          a.map(item => {
+            if (item.response && item.status == 'done') {
+              temp.push(item.response.data)
+            }
+          })
+          obj = temp.join(',')
+        } else if (this.uploadType == 'attach') { // 附件    将接口的返回数据返回页面
+          a.map(item => {
+            if (item.response && item.status == 'done') {
+              if (_this.maxNums == 1) {
+                temp = [item.response.data]
+              } else {
+                temp = [...temp, ...item.response.data]
+              }
+            }
+          })
+          obj = JSON.stringify(temp)
+        }
       }
-      return temp.join(',')
+      return obj
     },
     // 文件校验
     validaFile (file, filesList) {
       if (filesList.length == 0) {
         return []
       }
-
-      console.log(file, filesList, this.beforeUpload(file, 0))
+      // console.log(file, filesList, this.beforeUpload(file, 0))
       if (!this.beforeUpload(file, 0) && file.status != 'removed') {
         const index = filesList.findIndex(item => item.uid == file.uid)
         filesList.splice(index, 1)
@@ -159,17 +207,24 @@ export default {
     beforeUpload (file, tip) {
       // 不限制
       if (this.fileType == '*') {
+        // 文件大小
+        const isLt2M = file.size / 1024 / 1024 < this.fileSize
+        if (!isLt2M) {
+          if (tip != 0) {
+            this.$message.error('上传文件不能超过 ' + this.fileSize + 'MB!')
+          }
+          return isLt2M
+        }
         return true
       }
-
       const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
-      if (!isType) {
+      // 文件格式限制为.xls、.xlsx时,上传.csv文件的type为application/vnd.ms-excel,与.xls一致,无法限制,因此更改为:
+      if (!isType || file.name.indexOf('.csv') >= 0) {
         if (tip != 0) {
           this.$message.error('请上传正确的格式!')
         }
-        return isType
+        return isType && !(file.name.indexOf('.csv') >= 0)
       }
-
       // 文件大小
       const isLt2M = file.size / 1024 / 1024 < this.fileSize
       if (!isLt2M) {
@@ -192,10 +247,12 @@ export default {
   .upload-file{
     float: left;
     overflow: hidden;
+    height: 80px;
     /* you can make up upload button and sample style by using stylesheets */
     .ant-upload-select-picture-card i {
       font-size: 32px;
       color: #999;
+      margin-top: 9px;
     }
     .ant-upload-select-picture-card .ant-upload-text {
       margin-top: 8px;
@@ -207,11 +264,16 @@ export default {
         padding: 4px 0;
       }
     }
+    .ant-upload-list-picture-card-container{
+      height: 80px;
+      width: 80px;
+    }
     .ant-upload.ant-upload-select-picture-card,
     .ant-upload-list-picture-card .ant-upload-list-item{
       width:80px;
       height:80px;
       padding: 4px;
+      margin: 0;
     }
     .ant-upload-list-item-info{
       padding: 0 22px 0 4px;

+ 0 - 2
src/views/appSetting/versionSettings/editModal.vue

@@ -69,7 +69,6 @@
               :maxNums="1"
               :fileSize="100"
               fileType="application/vnd.android.package-archive"
-              :action="attachAction"
               :uploadParams="uploadParams"
               @change="changeImport"
               upText="附件上传"></Upload>
@@ -126,7 +125,6 @@ export default {
         upgradeContent: [ { required: true, message: '请输入升级内容', trigger: 'blur' } ],
         attachment: [ { required: true, message: '请上传app安装文件', trigger: 'change' } ]
       },
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
       uploadParams: {
         savePathType: 'ali'
       }

+ 67 - 0
src/views/common/customeList.vue

@@ -0,0 +1,67 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :value="customerName"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    @search="fetchUser"
+    @change="handleChange"
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.customerSn" :value="item.customerSn">
+      {{ item.customerName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { customerQueryPageList } from '@/api/dealer'
+export default {
+  props: {
+    tenantId: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      customerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (customerName) {
+      console.log('fetching user', customerName)
+      if (customerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      customerQueryPageList({ 'customerName': customerName, tenantId: this.tenantId, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data.list || []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        customerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value)
+    },
+    resetForm () {
+      this.customerName = []
+    }
+  }
+}
+</script>

+ 63 - 0
src/views/common/dealerList.vue

@@ -0,0 +1,63 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :value="dealerName"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    @search="fetchUser"
+    @change="handleChange"
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.dealerSn" :value="item.dealerSn">
+      {{ item.dealerName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { dealerQueryPageList } from '@/api/dealer'
+export default {
+  props: {
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      dealerQueryPageList({ 'dealerName': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data.list || []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value)
+    },
+    resetForm () {
+      this.dealerName = []
+    }
+  }
+}
+</script>

+ 21 - 8
src/views/numsGoodsShelves/approveStore/authPass.vue

@@ -119,9 +119,15 @@
                 ></v-select>
               </a-form-model-item>
             </a-col>
+            <a-col :span="12">
+              <a-form-model-item label="绑定汽配商" prop="delearSn">
+                <dealerList ref="dealerList" @change="dealerChange" v-model="form.delearSn"></dealerList>
+              </a-form-model-item>
+            </a-col>
             <a-col :span="12">
               <a-form-model-item label="关联客户" prop="customerSn">
-                <custList ref="custList" :isEnabled="true" @change="custChange" v-model="form.customerSn"></custList>
+                <customeList ref="customeList" v-if="form.delearSn" :tenantId="form.delearSn" @change="custChange" v-model="form.customerSn"></customeList>
+                <span v-else>请先选择绑定汽配商</span>
               </a-form-model-item>
             </a-col>
             <a-col :span="12">
@@ -141,12 +147,13 @@
 
 <script>
 import { STable, VSelect, Upload } from '@/components'
-import { getArea } from '@/api/data'
-import custList from '@/views/common/custList.vue'
+import { getAreaCgj } from '@/api/data'
+import dealerList from '@/views/common/dealerList.vue'
+import customeList from '@/views/common/customeList.vue'
 import { xprhStoreApplyDetail, xprhStoreApplyAudit } from '@/api/approveStore'
 export default {
   name: 'ApproveStoreAuthPass',
-  components: { STable, VSelect, custList, Upload },
+  components: { STable, VSelect, dealerList, customeList, Upload },
   data () {
     return {
       spinning: false,
@@ -175,6 +182,7 @@ export default {
         auditStatus: 'PASS' // 通过
       },
       rules: {
+        storeImage: [{ required: true, message: '请上传门头照片', trigger: 'change' }],
         storeName: [{ required: true, message: '请输入门店名称', trigger: 'blur' }],
         contactMobile: [{ required: false, pattern: /^\d{30}$/, message: '请输入正确的手机号', trigger: 'blur' }],
         addrProvince: [{ required: true, message: '请选择省', trigger: 'change' }],
@@ -183,6 +191,7 @@ export default {
         addrDetail: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
         contactName: [{ required: true, message: '请输入联系人姓名', trigger: 'change' }],
         settleType: [{ required: true, message: '请选择收结算方式', trigger: 'change' }],
+        delearSn: [{ required: true, message: '请选择绑定汽配商', trigger: 'change' }],
         customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }],
         creditLimit: [{ required: true, message: '请输入授信额度', trigger: 'change' }]
       },
@@ -200,9 +209,13 @@ export default {
       str = str.replace(/[\r\n]/g, '')
       this.form.storeName = str
     },
+    // 经销商
+    dealerChange (value) {
+      this.form.delearSn = value ? value.key : undefined
+    },
     // 关联客户
-    custChange (obj, row) {
-      this.form.customerSn = row ? obj.key : undefined
+    custChange (value) {
+      this.form.customerSn = value ? value.key : undefined
     },
     //  图片上传
     changeImage1 (file) {
@@ -217,7 +230,7 @@ export default {
       xprhStoreApplyDetail({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           if (res.data.addrProvince) { this.getArea('city', res.data.addrProvince) }
-          if (res.data.addrDistrict) { this.getArea('district', res.data.addrDistrict) }
+          if (res.data.addrDistrict) { this.getArea('district', res.data.addrCity) }
           this.form = Object.assign(this.form, res.data)
           this.$refs.storeImage.setFileList(res.data.storeImage)
           this.$refs.licenseImage.setFileList(res.data.licenseImage)
@@ -303,7 +316,7 @@ export default {
       } else {
         params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
       }
-      getArea(params).then(res => {
+      getAreaCgj(params).then(res => {
         if (res.status == 200) {
           if (leve == 'province') {
             this.addrProvinceList = res.data || []

+ 13 - 8
src/views/numsGoodsShelves/approveStore/list.vue

@@ -54,8 +54,8 @@
         bordered>
         <!-- 图片 -->
         <template slot="imageUrl" slot-scope="text, record">
-          <div v-if="text.length">
-            <img :src="text" width="30" height="30" class="imageUrl" @click="inited([text])" />
+          <div v-if="text&&text.length">
+            <img :src="text" width="30" height="30" class="imageUrl" @click="inited(text)" />
           </div>
           <span v-else>--</span>
         </template>
@@ -67,7 +67,7 @@
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
-          <div v-if="record.auditStatus == 'WAIT'">
+          <div v-if="record.auditStatus == 'WAIT'&&!record.inviteCode">
             <a-button size="small" type="link" class="button-primary" @click="handleAudit(record,1)">通过</a-button>
             <a-button size="small" type="link" class="button-primary" @click="handleAudit(record,0)">不通过</a-button>
           </div>
@@ -99,8 +99,10 @@ export default {
         { title: '提交时间', dataIndex: 'applyTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '联系人手机', dataIndex: 'contactPhone', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '联系人姓名', dataIndex: 'contactName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '门店名称', dataIndex: 'storeName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '门店地址', dataIndex: 'addrDetail', width: '28%', align: 'center', scopedSlots: { customRender: 'addr' }, ellipsis: true },
+        { title: '门店名称', dataIndex: 'storeName', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '门店地址', dataIndex: 'addrDetail', width: '15%', align: 'center', scopedSlots: { customRender: 'addr' }, ellipsis: true },
+        { title: '汽配商邀请码', dataIndex: 'inviteCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '邀请码关联汽配商', dataIndex: 'dealerName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '门头照片', dataIndex: 'storeImage', width: '6%', align: 'center', scopedSlots: { customRender: 'imageUrl' } },
         { title: '营业执照', dataIndex: 'licenseImage', width: '6%', align: 'center', scopedSlots: { customRender: 'imageUrl' } },
         { title: '状态', dataIndex: 'auditStatusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -130,9 +132,12 @@ export default {
   },
   methods: {
     inited (viewer) {
-      if (viewer.length) {
-        this.$viewerApi({
-          images: viewer
+      if (viewer && viewer.length) {
+        this.$info({
+          title: '图片预览',
+          okText: '关闭',
+          width: '600px',
+          content: (h) => { return h('img', { attrs: { src: viewer }, style: { width: '100%' } }) }
         })
       }
     },

+ 2 - 2
vue.config.js

@@ -108,8 +108,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.16.103:8501/qpls-it',
-        target: 'http://p.it.360arrow.com/qpls-it',
+        target: 'http://192.168.0.102:8501/qpls-it',
+        // target: 'http://p.it.360arrow.com/qpls-it',
         ws: false,
         changeOrigin: true,
         pathRewrite: {