panhui 4 yıl önce
ebeveyn
işleme
9bdf610bae
3 değiştirilmiş dosya ile 56 ekleme ve 10 silme
  1. 1 1
      .env.development
  2. 7 0
      src/pages/chat.vue
  3. 48 9
      src/pages/store/homePage.vue

+ 1 - 1
.env.development

@@ -1 +1 @@
-VUE_APP_BASE_URL=https://zhuoka.izouma.com
+VUE_APP_BASE_URL=http://192.168.50.120:8080

+ 7 - 0
src/pages/chat.vue

@@ -56,6 +56,13 @@ export default {
             return this.showAttach ? 114 : 0;
         }
     },
+    onLoad(options) {
+        if (options.toName) {
+            wx.setNavigationBarTitle({
+                title: options.toName
+            });
+        }
+    },
     methods: {
         sendImg() {
             this.choosePhoto().then(res => {

+ 48 - 9
src/pages/store/homePage.vue

@@ -50,10 +50,16 @@
             </van-sticky>
             <div class="list-content">
                 <div class="procuct" v-for="(item, index) in list" :key="index">
-                    <van-icon color="#C8C9CC" class="check" name="circle" size="18px" />
-                    <product-info :info="item" :isMine="isMineShop" :showBtn="isManage"></product-info>
+                    <van-icon
+                        v-if="isManage"
+                        :color="checkChoose(item.id) ? $colors.prim : '#C8C9CC'"
+                        class="check"
+                        :name="checkChoose(item.id) ? 'checked' : 'circle'"
+                        size="18px"
+                    />
+                    <product-info :info="item" :isMine="isMineShop" :showBtn="isManage" @click="choose"></product-info>
                 </div>
-
+                <van-icon name="checked" />
                 <van-empty
                     v-if="empty"
                     image="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/wechat/kong_png_wukabao.png"
@@ -65,14 +71,14 @@
 
         <div class="bottom">
             <block v-if="isManage">
-                <button-bg type="warning" openType="share">新增商品 </button-bg>
-                <button-bg type="prim" isRight v-if="chooseIds.length > 0">删除</button-bg>
+                <button-bg type="warning">新增商品 </button-bg>
+                <button-bg type="prim" isRight v-if="chooseIds.length > 0" @click="del">删除</button-bg>
                 <button-bg type="prim" isRight v-else @click="isManage = false">完成</button-bg>
             </block>
             <block v-else>
                 <button-bg type="warning" openType="share">分享店铺 </button-bg>
                 <button-bg type="prim" isRight v-if="isMineShop" @click="isManage = true">管理商品</button-bg>
-                <button-bg type="prim" isRight v-else @click="wait">联系他</button-bg>
+                <button-bg type="prim" isRight v-else @click="chatWith">联系他</button-bg>
             </block>
         </div>
     </div>
@@ -165,30 +171,63 @@ export default {
         changeStatus(value) {
             console.log(value);
             this.caseStatus = value.detail;
+            this.sort = '';
             this.getData();
         },
         getData() {
             this.empty = false;
             let data = {
-                storeId: this.storeInfo.id,
-                caseStatus: this.caseStatus
+                storeId: this.storeInfo.id
             };
+            if (this.caseStatus) {
+                data.caseStatus = this.caseStatus;
+            }
             if (this.sort) {
                 data.sortStr = this.sort;
             }
             this.showLoading();
-            this.$http.post('/store/findStoreCases', data).then(res => {
+            return this.$http.post('/store/findStoreCases', data).then(res => {
                 this.list = res.caseInfo;
                 if (res.caseInfo.length == 0) {
                     this.empty = true;
                 }
                 this.hideLoading();
+                return Promise.resolve();
             });
         },
+        del() {
+            this.$http
+                .get('/cardCase/multipleDelete', {
+                    caseIds: this.chooseIds
+                })
+                .then(res => {
+                    return this.getData();
+                })
+                .then(() => {
+                    this.toast('删除成功', 'success');
+                    this.chooseIds = [];
+                });
+        },
         goNext() {
             if (this.isMineShop) {
                 this.navigateTo('/pages/store/setting');
             }
+        },
+        chatWith() {
+            this.navigateTo('/pages/chat?toUserId=' + this.storeInfo.userId + '&toName=' + this.storeInfo.storeName);
+        },
+        checkChoose(id) {
+            let list = [...this.chooseIds];
+            return list.includes(id);
+        },
+        choose(id) {
+            let list = [...this.chooseIds];
+            if (this.checkChoose(id)) {
+                list.splice(list.indexOf(id), 1);
+            } else {
+                list.push(id);
+            }
+            this.chooseIds = list;
         }
     },
     onPageScroll() {},