yuwenjun 4 vuotta sitten
vanhempi
commit
f9e40aa320

+ 3 - 0
.env.development

@@ -7,3 +7,6 @@ VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
 
 # 文件上传
 VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
+
+#二维码生成链接server
+VUE_APP_BASE_SERVER = 'https://www-b.caimei365.com'

+ 4 - 1
.env.production

@@ -9,4 +9,7 @@ VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
 # VUE_APP_BASE_API = 'http://192.168.2.68:8012'
 
 # 文件上传
-VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
+VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
+
+#二维码生成链接server
+VUE_APP_BASE_SERVER = 'https://www-b.caimei365.com'

+ 1 - 3
src/components/qrcode/index.vue

@@ -38,13 +38,11 @@ export default {
   data() {
     return {
       imgUrl: '',
-      wwwServer: process.env.VUE_APP_BASE_API,
+      wwwServer: process.env.VUE_APP_BASE_SERVER,
       qrcodePath: ''
     }
   },
   created() {
-    console.log(this.productInfo)
-
     this.initQrcode()
   },
   methods: {

+ 2 - 1
src/store/getters.js

@@ -15,6 +15,7 @@ const getters = {
   errorLogs: state => state.errorLog.logs,
   initRouter: state => state.permission.initRouter,
   proxyInfo: state => state.user.proxyInfo,
-  shopType: state => state.user.shopType
+  shopType: state => state.user.shopType,
+  brandId: state => state.user.brandId
 }
 export default getters

+ 5 - 3
src/store/modules/user.js

@@ -24,7 +24,8 @@ const state = {
   authUserId: userInfo?.authUserId || '',
   userIdentity: userInfo?.userIdentity || '',
   proxyInfo: null,
-  shopType: userInfo?.shopType || ''
+  shopType: userInfo?.shopType || '',
+  brandId: userInfo?.brandId || ''
 }
 
 const mutations = {
@@ -42,6 +43,7 @@ const mutations = {
     state.authUserId = userInfo.authUserId
     state.userIdentity = userInfo.userIdentity
     state.shopType = userInfo.shopType
+    state.brandId = userInfo.brandId
   },
   SET_PROXY_INFO: (state, proxyInfo) => {
     state.proxyInfo = proxyInfo
@@ -57,10 +59,10 @@ const actions = {
     const { username, password } = userInfo
     return new Promise((resolve, reject) => {
       login({ mobileOrName: username.trim(), password: password }).then(response => {
-        const { shopStatus, token, authUserId, userIdentity, name, shopType } = response.data
+        const { shopStatus, token, authUserId, userIdentity, name, shopType, brandId } = response.data
         const roles = formatRoles(userIdentity)
         commit('SET_TOKEN', token) // 保存token
-        commit('SET_USERINFO', { shopStatus, authUserId, userIdentity, shopType }) // 保存用户信息
+        commit('SET_USERINFO', { shopStatus, authUserId, userIdentity, shopType, brandId }) // 保存用户信息
         commit('SET_ROLES', roles) // 根据用户类型生成角色列表
         commit('SET_NAME', name) // 保存用户名称
         // commit('app/SET_IS_REFRESH', false)

+ 9 - 1
src/views/supplier/components/uploadImage.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div class="img-upload-box">
     <el-upload
       ref="upload"
       :action="action"
@@ -79,3 +79,11 @@ export default {
   }
 }
 </script>
+
+<style lang="scss" scoped>
+.img-upload-box{
+  width:150px;
+  height:150px;
+  overflow: hidden
+}
+</style>

+ 11 - 3
src/views/supplier/product/add.vue

@@ -126,15 +126,20 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['authUserId', 'proxyInfo', 'shopType'])
+    ...mapGetters(['authUserId', 'proxyInfo', 'shopType', 'brandId'])
   },
   created() {
     this.formData.authId = this.$route.query.id
     this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
     this.initParamList()
+    // 如果供应商类型为代理商  则需要获取它代理的品牌列表
     if (this.shopType === 2) {
       this.getBrandList()
     }
+    // 如果供应商类型为品牌方,则自动设置品牌id
+    if (this.shopType === 1) {
+      this.formData.brandId = this.proxyInfo?.brandId || this.brandId || ''
+    }
   },
   methods: {
     handleChange() {
@@ -155,10 +160,13 @@ export default {
       this.formData.createBy = this.proxyInfo?.authUserId || this.authUserId
       this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
       saveProduct(this.formData).then(res => {
-        this.$message.success(res.data)
+        if (res.code !== 0) {
+          return
+        }
+        this.$message.success('保存成功')
         this.$refs.addFormRef.resetFields()
         this.clearFormData()
-        this.$router.replace(`/product/list?id=${this.formData.authId}`)
+        this.$router.push(`/product/list?id=${this.formData.authId}`)
       }).finally(() => {
         this.isLoading = false
       })

+ 6 - 2
src/views/supplier/product/edit.vue

@@ -113,15 +113,19 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['authUserId', 'proxyInfo', 'shopType'])
+    ...mapGetters(['authUserId', 'proxyInfo', 'shopType', 'brandId'])
   },
   created() {
-    this.formData.productId = this.$route.query.id
+    this.formData.productId = parseInt(this.$route.query.id)
     this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
     this.initFormData()
     if (this.shopType === 2) {
       this.getBrandList()
     }
+    // 如果供应商类型为品牌方,则自动设置品牌id
+    if (this.shopType === 1) {
+      this.formData.brandId = this.proxyInfo?.brandId || this.brandId || ''
+    }
   },
   methods: {
     // 提交

+ 2 - 3
src/views/supplier/product/index.vue

@@ -58,7 +58,7 @@
     <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
 
     <!-- 二维码 -->
-    <qrcode :is-visible="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
+    <qrcode v-if="showQRcode" :is-visible="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
   </div>
 </template>
 
@@ -161,9 +161,8 @@ export default {
     },
     // 显示二维码
     handleShowQRcode(item) {
-      this.showQRcode = true
-      console.log(item)
       this.productInfo = item
+      this.showQRcode = true
     }
   }
 }

+ 9 - 1
src/views/supplier/user/add.vue

@@ -88,7 +88,8 @@
 
     <!-- 供应商添加品牌的对话框 -->
     <el-dialog v-loading="dialogLoading" title="添加代理品牌" :visible.sync="showDialog" width="width" @closed="dialogClosed">
-      <el-form ref="brandDataRef" :model="brandData" :rules="brandDataRules" label-width="100px">
+      <el-form ref="brandDataRef" :model="brandData" :rules="brandDataRules" label-width="120px">
+
         <el-form-item label="选择品牌:" prop="brandId">
           <el-select
             v-model="brandData.brandId"
@@ -174,6 +175,11 @@
           />
           <el-input v-model="brandData.statementFileId" type="hidden" class="hiddenInput" />
         </el-form-item>
+
+        <el-form-item label="官网认证链接:">
+          <el-input v-model="brandData.securityLink" placeholder="请输入官网认证链接" />
+        </el-form-item>
+
       </el-form>
 
       <div slot="footer">
@@ -435,6 +441,7 @@ export default {
     },
     // 添加品牌对话框开启
     handleShowDialog() {
+      this.brandData.brandId = ''
       this.showDialog = true
     },
     // 添加品牌
@@ -501,6 +508,7 @@ export default {
     // 对话框关闭
     dialogClosed() {
       this.$refs.brandDataRef.resetFields()
+      this.brandData.brandId = ''
       this.fileList1 = []
       this.fileList2 = []
       this.fileList3 = []

+ 13 - 1
src/views/supplier/user/edit.vue

@@ -90,7 +90,7 @@
 
     <!-- 供应商添加品牌的对话框 -->
     <el-dialog v-loading="dialogLoading" title="添加代理品牌" :visible.sync="showDialog" width="width" @closed="dialogClosed">
-      <el-form ref="brandDataRef" :model="brandData" :rules="brandDataRules" label-width="100px">
+      <el-form ref="brandDataRef" :model="brandData" :rules="brandDataRules" label-width="120px">
         <el-form-item label="选择品牌:" prop="brandId">
           <el-select
             v-model="brandData.brandId"
@@ -176,6 +176,11 @@
           />
           <el-input v-model="brandData.statementFileId" type="hidden" class="hiddenInput" />
         </el-form-item>
+
+        <el-form-item label="官网认证链接:">
+          <el-input v-model="brandData.securityLink" placeholder="请输入官网认证链接" />
+        </el-form-item>
+
       </el-form>
 
       <div slot="footer">
@@ -320,6 +325,9 @@ export default {
           ...this.addFromData,
           ...data.shopInfo[0]
         }
+        if (this.addFromData.brandAuthLogo) {
+          this.fileList1 = [{ name: '', url: this.addFromData.brandAuthLogo }]
+        }
         this.addFromData.shopInfo = []
       }
       if (this.addFromData.shopType === 2) {
@@ -421,6 +429,9 @@ export default {
     },
     // 获取品牌列表
     getBrandList(type) {
+      if (this.addFromData.shopType === 1) {
+        type = 2
+      }
       // 获取品牌列表
       fetchBrandList({ type })
         .then(res => {
@@ -535,6 +546,7 @@ export default {
     },
     // 对话框关闭
     dialogClosed() {
+      console.log('添加框关闭')
       this.$refs.brandDataRef.resetFields()
       this.fileList1 = []
       this.fileList2 = []

+ 1 - 0
src/views/supplier/user/index.vue

@@ -163,6 +163,7 @@ export default {
         this.total = total
         this.formatList(list)
         this.list = list
+        console.log(this.list)
       }).catch(err => { console.log(err) }).finally(() => {
         this.listLoading = false
       })