shish 3 лет назад
Родитель
Сommit
02bf4ca684
2 измененных файлов с 40 добавлено и 21 удалено
  1. 18 17
      hdApp/src/admin/home/workbench.vue
  2. 22 4
      hdApp/src/pagesPurchase/order.vue

+ 18 - 17
hdApp/src/admin/home/workbench.vue

@@ -196,7 +196,7 @@
 </view>
 </template>
 <script>
-import { mapGetters, mapState } from "vuex";
+import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite";
 import { getStat,getStrokeCount } from '@/api/console'
 import { consoleIndex } from "@/api/workbench";
@@ -364,12 +364,27 @@ export default {
       this.pageTo({url:'/pagesPurchase/addCg?ghsId='+item.id+'&ghsName='+item.name})
     },
     enterShop(item) {
+      let that = this
       if(item.isOpen == 0){
         this.$msg('已休店,请选择其它门店')
         return false
       }
-      const { id } = item
-      this.pageTo({url: '/pagesPurchase/ghsProduct?id='+id})
+      if(this.dictInfo && this.dictInfo.subscribeMessage && this.dictInfo.subscribeMessage == 1 && this.dictInfo.hdMiniMessage && this.dictInfo.hdMiniMessage.giveCoupon){
+        uni.requestSubscribeMessage({
+          tmplIds: [this.dictInfo.hdMiniMessage.giveCoupon.msgId,this.dictInfo.hdMiniMessage.cgSuccess.msgId],
+          success(res) {
+            console.log(res)
+          },
+          fail(err) {
+            console.log(err)
+          },
+          complete() {
+            that.pageTo({url: '/pagesPurchase/ghsProduct?id='+item.id}) 
+          }
+        })
+      }else{
+        that.pageTo({url: '/pagesPurchase/ghsProduct?id='+item.id})
+      }
     },
     settleAccounts (item) {
       this.pageTo({ url: '/pagesPurchase/gathering?id='+item.id})
@@ -385,20 +400,6 @@ export default {
     },
     goGd(){
 
-      // uni.requestSubscribeMessage({
-      //   tmplIds: ['dtzw008ZnN41VYRrLrpvZAJHJw-_2pLb9UVanNOatS0','ZfCmPfD96W_H0-pWDyQHCJQC5ht41NXtTS8nP28xKQQ'],
-      //   success(res) {
-      //     console.log(res)
-      //   },
-      //   fail(err) {
-      //     //消息订阅调起失败
-      //   },
-      //   complete() {
-      //     // 无论确定还是取消,只要点击按钮后都会执行
-      //   },
-      // })
-      //return false
-
       //选择花材生成制作单和订单
       this.$util.pageTo({url:'/admin/order/workOrder'})
     },

+ 22 - 4
hdApp/src/pagesPurchase/order.vue

@@ -58,6 +58,7 @@
   </view>
 </template>
 <script>
+import { mapGetters } from "vuex";
 import emptyComponent from "@/components/empty";
 import { ghsList } from "@/api/purchase";
 import { changeDelStatus } from "@/api/ghs";
@@ -77,8 +78,10 @@ export default {
       uni.stopPullDownRefresh();
     })
   },
+  computed: {
+    ...mapGetters({ dictInfo:"getDictionariesInfo" })
+  },
   methods: {
-
     addGhs(){
       this.pageTo({url: '/admin/ghs/addGhs'})
     },
@@ -115,12 +118,27 @@ export default {
       this.pageTo({url: '/pagesPurchase/addCg?ghsId='+item.id+'&ghsName='+item.name})
     },
     enterShop(item) {
+      let that = this
       if(item.isOpen == 0){
-        this.$msg('已休店,请选择其它门店')
+        that.$msg('已休店,请选择其它门店')
         return false
       }
-      const { id } = item
-      this.pageTo({url: '/pagesPurchase/ghsProduct?id='+id})
+      if(this.dictInfo && this.dictInfo.subscribeMessage && this.dictInfo.subscribeMessage == 1 && this.dictInfo.hdMiniMessage && this.dictInfo.hdMiniMessage.giveCoupon){
+        uni.requestSubscribeMessage({
+          tmplIds: [this.dictInfo.hdMiniMessage.giveCoupon.msgId,this.dictInfo.hdMiniMessage.cgSuccess.msgId],
+          success(res) {
+            console.log(res)
+          },
+          fail(err) {
+            console.log(err)
+          },
+          complete() {
+            that.pageTo({url: '/pagesPurchase/ghsProduct?id='+item.id})
+          }
+        })
+      }else{
+        that.pageTo({url: '/pagesPurchase/ghsProduct?id='+item.id})
+      }
     },
     init() {
       this.getGHSList()