فهرست منبع

feat 代码优化

Funny 3 سال پیش
والد
کامیت
5c06ad8260
5فایلهای تغییر یافته به همراه97 افزوده شده و 21 حذف شده
  1. 4 4
      package.json
  2. 4 0
      src/api/shop.js
  3. 23 11
      src/components/shopCompoents/bindDelivery.vue
  4. 65 3
      src/components/shopCompoents/bindTakeOut.vue
  5. 1 3
      vue.config.js

+ 4 - 4
package.json

@@ -1,16 +1,16 @@
 {
   "name": "liebao-web",
-  "version": "0.2.0",
+  "version": "0.4.0",
   "private": true,
-  "author": "[15151556015@163.com/Funny]",
+  "author": "优巨引擎",
   "description": "有运力的地方,就有猎豹AI。",
   "scripts": {
     "serve": "vue-cli-service serve",
     "build:test": "vue-cli-service build --mode test",
     "build:prod": "vue-cli-service build --mode production",
     "lint": "vue-cli-service lint",
-    "electron:build": "vue-cli-service electron:build --mode production",
-    "electron:buildTest": "vue-cli-service electron:build --mode development",
+    "electron:build": "vue-cli-service electron:build --mode production --ia32",
+    "electron:buildTest": "vue-cli-service electron:build --mode development --ia32",
     "electron:serve": "vue-cli-service electron:serve",
     "postinstall": "electron-builder install-app-deps",
     "postuninstall": "electron-builder install-app-deps",

+ 4 - 0
src/api/shop.js

@@ -194,4 +194,8 @@ export const getShopListNew = (params) => {
 // 新绑定外卖平台
 export const bindTakeOutNew = (params) => {
   return post('app/waimai/bindNew', params)
+}
+// 外卖平台绑定门店更换
+export const bindChangeShop = (params) => {
+  return post('app/waimai/changeShop', params)
 }

+ 23 - 11
src/components/shopCompoents/bindDelivery.vue

@@ -19,7 +19,12 @@
               <div v-if="[1, 2, 5, 9, 13].includes(type)" class="info-line">门店编号:{{type === 1 ? (v.dadaShopNo || '--') : type ===9 ? (v.dadaYzShopNo || '--') : type === 5 ? v.thirdShopId : '--'}}</div>
               <div v-else class="info-line">商户编号:{{ v.thirdShopId || '--' }}</div>
               <div class="balance">账户余额:{{typeof v.balance === 'number' ? '¥ ' + v.balance : '--'}}</div>
-              <div class="refuse" v-if="type === 5 && v.bindStatus === 3">审核失败:{{v.authMsg}}</div>
+              <el-tooltip v-if="type === 5 && v.bindStatus === 3" effect="dark" placement="top-start">
+                <div slot="content">{{v.authMsg}}</div>
+                <div class="refuse">审核失败:
+                  {{v.authMsg}}
+                </div>
+              </el-tooltip>
             </div>
           </div>
           <div v-if="type === 5 && [2,3].includes(v.bindStatus)" :class="['status',v.bindStatus === 2 ? '' : 'bt-refuse']">{{v.bindStatus === 2 ? '审核中' : '审核失败'}}</div>
@@ -51,8 +56,8 @@
           <el-input v-model="params.mobile" placeholder="请输入手机号"></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button @click="goBind">重新绑定</el-button>
-          <el-button type="primary" @click="confirm">确认</el-button>
+          <el-button size="small" @click="goBind">重新绑定</el-button>
+          <el-button size="small" type="primary" @click="confirm">确认</el-button>
         </el-form-item>
       </el-form>
     </el-dialog>
@@ -186,7 +191,10 @@ export default {
   },
   computed: {
     type() {
-      return this.deliveryList[this.curIndex] && this.deliveryList[this.curIndex].deliveryType;
+      return (
+        this.deliveryList[this.curIndex] &&
+        this.deliveryList[this.curIndex].deliveryType
+      );
     },
   },
   created() {
@@ -262,8 +270,8 @@ export default {
       this.shopId = v.shopId;
       // 绑定顺丰同城
       if (this.type === 5) {
-        this.sfId = ''
-        this.sfId2 = ''
+        this.sfId = "";
+        this.sfId2 = "";
         this.centerDialogVisible2 = true;
         return;
       }
@@ -308,7 +316,7 @@ export default {
         this.getBindDeliveryShopList();
       } else {
         let shop = this.deliveryList[i];
-        console.log('shop',shop);
+        console.log("shop", shop);
         this.shopList = [
           {
             id: shop.id,
@@ -320,7 +328,7 @@ export default {
         ];
       }
     },
-  
+
     getDeliveryList() {
       this.loading = true;
       getDeliveryList().then((res) => {
@@ -473,7 +481,7 @@ export default {
       this.$prompt("", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        inputPlaceholder: '请输入绑定时顺丰同城ID号',
+        inputPlaceholder: "请输入绑定时顺丰同城ID号",
         center: true,
       }).then(({ value }) => {
         if (!value || v.thirdShopId !== value) {
@@ -537,6 +545,7 @@ export default {
             type: "success",
             message: "成功完善资料!",
           });
+          this.centerDialogVisible3 = false;
           // this.getDeliveryList();
           this.getBindDeliveryShopList();
         } else {
@@ -545,7 +554,6 @@ export default {
             message: res.msg,
           });
         }
-        this.centerDialogVisible3 = false;
       });
     },
   },
@@ -696,6 +704,7 @@ export default {
             white-space: nowrap;
             text-overflow: ellipsis;
             overflow: hidden;
+            cursor: pointer;
           }
         }
       }
@@ -715,7 +724,10 @@ export default {
           cursor: pointer;
         }
         .unbind {
-          background: rgba(252, 114, 0, 0.6);
+          background: #f5f5f5;
+          color: #333333;
+          border: 1px solid #e6e6e6;
+          border-radius: 0 0 8px 8px;
         }
       }
     }

+ 65 - 3
src/components/shopCompoents/bindTakeOut.vue

@@ -34,14 +34,15 @@
         </div>
       </div>
     </div>
-    <el-dialog :title="`绑定美${waimaiList[curIndex] && waimaiList[curIndex].name}`" :visible.sync="centerDialogVisible" @close="close" width="520px" center>
+    <!-- 绑定外卖平台 -->
+    <el-dialog :title="`绑定${waimaiList[curIndex] && waimaiList[curIndex].name}`" :visible.sync="centerDialogVisible" @close="close" width="520px" center>
       <el-form label-width="80px">
         <el-form-item label="店铺">
           <el-select v-model="params.shopId" placeholder="请选择店铺">
             <el-option v-for="(v,i) in shopList" :key="i" :label="v.name" :value="v.id"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="平台ID" v-if="type === 3">
+        <el-form-item label="平台ID" v-if="type === 3 || type === 5">
           <el-input v-model="params.code"></el-input>
         </el-form-item>
         <el-form-item label="授权方式" v-if="type === 1">
@@ -62,6 +63,29 @@
         <el-button class="btn" size="small" type="primary" @click="bindMT">确 定</el-button>
       </span>
     </el-dialog>
+    <!-- 店铺详情 -->
+    <el-dialog title="店铺详情" :visible.sync="showDetail" width="30%" center>
+      <el-form ref="form" :model="form" label-width="80px">
+        <el-form-item label="店铺名称">
+          <el-input disabled v-model="form.thirdShopName"></el-input>
+        </el-form-item>
+        <el-form-item label="店铺ID">
+          <el-input disabled v-model="form.thirdShopId"></el-input>
+        </el-form-item>
+        <el-form-item label="店铺类型">
+          <el-input disabled v-model="form.productName"></el-input>
+        </el-form-item>
+        <el-form-item label="关联门店">
+          <el-select v-model="form.shopId" placeholder="请选择店铺">
+            <el-option v-for="(v,i) in shopList" :key="i" :label="v.name" :value="v.id"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="showDetail = false">取 消</el-button>
+        <el-button size="small" type="primary" @click="bindChangeShop">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -78,6 +102,7 @@ import {
   releaseTakeOut,
   setTakeOut,
   getBindWaimaiShop,
+  bindChangeShop,
 } from "../../api/shop";
 export default {
   data() {
@@ -100,6 +125,13 @@ export default {
         mtBindType: 1,
         code: "",
       },
+      showDetail: false,
+      form: {
+        thirdShopName: "",
+        thirdShopId: "",
+        productName: "",
+        shopId: "",
+      },
     };
   },
   watch: {
@@ -144,6 +176,31 @@ export default {
     }
   },
   methods: {
+    bindChangeShop() {
+      bindChangeShop({ id: this.form.id, shopId: this.form.shopId }).then(
+        (res) => {
+          if (res.code === 200) {
+            this.$message({
+              type: "success",
+              message: "保存成功",
+            });
+            this.showDetail = false;
+            this.getBindWaimaiShop();
+          } else {
+            this.$message({
+              type: "error",
+              message: res.msg,
+            });
+          }
+        }
+      );
+    },
+    async editShop(v) {
+      console.log('门店编辑:',v);
+      await this.getShopListNew();
+      this.form = JSON.parse(JSON.stringify(v));
+      this.showDetail = true;
+    },
     close() {
       console.log("进来关闭");
       this.showMT = false;
@@ -217,12 +274,17 @@ export default {
     },
     bindMT() {
       // this.centerDialogVisible = false;
+      if(!this.params.shopId){
+        return this.$message({
+            type: "warning",
+            message: '请选择店铺',
+          });
+      }
       this.bind();
     },
     bind() {
       this.params.waimaiId = this.waimaiId;
       console.log("绑定", this.params);
-
       bindTakeOutNew(this.params).then((res) => {
         if (res.code === 200) {
           this.jumpUrl = res.data;

+ 1 - 3
vue.config.js

@@ -39,9 +39,7 @@ module.exports = {
         "win": {
           "icon": "./static/image/desk-logo.ico",
           "artifactName": `${name}-v${version}-setup.exe`,
-          "target": [{
-            "target": "nsis", "arch": ["ia32"]
-          }]
+          "target": [ { "target": "nsis", "arch": [ "x64", "ia32" ] } ] 
         },
         "linux": {
           "icon": "./static/image/desk-logo.ico",