Browse Source

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/pc-admin

许静 5 years ago
parent
commit
3f5d6af771
3 changed files with 34 additions and 10 deletions
  1. 4
    0
      src/config/api.js
  2. 3
    7
      src/store/modules/exchange.js
  3. 27
    3
      src/views/exchange/verify.vue

+ 4
- 0
src/config/api.js View File

@@ -275,6 +275,10 @@ const apis = {
275 275
     change: {
276 276
       method: 'put',
277 277
       url: `${commPrefix}/taPointsExchange/change`
278
+    },
279
+    update: {
280
+      method: 'put',
281
+      url: `${commPrefix}/taPointsExchange/:id`
278 282
     }
279 283
   },
280 284
   carouselFigure:{ // 轮播图列表查询

+ 3
- 7
src/store/modules/exchange.js View File

@@ -112,19 +112,15 @@ export default {
112 112
         })
113 113
       })
114 114
     },
115
-    cancelDynamic (_, payload) {
115
+    verifyById (_, payload) {
116 116
       return new Promise((resolve, reject) => {
117 117
         request({
118
-          ...apis.dynamic.cancel,
118
+          ...apis.exchange.update,
119 119
           urlData: payload,
120 120
         }).then((data) => {
121 121
           resolve(data)
122 122
         }).catch((err) => {
123
-          const message = err.message || err.msg
124
-
125
-          if (typeof message === 'string') {
126
-            reject(message)
127
-          }
123
+          reject(err)
128 124
         })
129 125
       })
130 126
     }

+ 27
- 3
src/views/exchange/verify.vue View File

@@ -27,8 +27,14 @@
27 27
         </div>
28 28
       </el-col>
29 29
     </el-row>
30
-    <el-button type="danger" style="margin:20px auto 0 auto;display:block" round>立即核销</el-button>
31
-    
30
+    <el-button type="danger" @click="showVerifyDialog = true" style="margin:20px auto 0 auto;display:block" round>立即核销</el-button>
31
+    <el-dialog title="核销数据" :visible.sync="showVerifyDialog">
32
+      <el-form>
33
+        <el-form-item label="扫描二维码数据">
34
+          <el-input v-model="verifyId" @keyup.enter.native="verifyEnter" placeholder="请用扫码枪扫描二维码"></el-input>
35
+        </el-form-item>
36
+      </el-form>
37
+    </el-dialog>
32 38
   </el-tab-pane>
33 39
   <el-tab-pane label="手机号核销">
34 40
     <el-row>
@@ -81,6 +87,8 @@ export default {
81 87
         status: ""
82 88
       },
83 89
       verifyPhone: "",
90
+      verifyId: "",
91
+      showVerifyDialog: false,
84 92
       list: [],
85 93
       pageNavi: {
86 94
         current: 1,
@@ -91,7 +99,7 @@ export default {
91 99
   },
92 100
   computed: {},
93 101
   methods: {
94
-    ...mapExchangeActions(["getExchanges"]),
102
+    ...mapExchangeActions(["getExchanges", "verifyById"]),
95 103
     getList() {
96 104
       const pageNumber = this.pageNavi.current || 1;
97 105
       const pageSize = this.pageNavi.size;
@@ -114,7 +122,23 @@ export default {
114 122
     addGoods() {
115 123
       this.$router.push({ name: "goods.edit" });
116 124
     },
125
+    verifyEnter() {
126
+      this.verifyById({
127
+        id: this.verifyId
128
+      })
129
+        .then(res => {
130
+         this.$notify.info("核销成功");
131
+         this.showVerifyDialog = false;
132
+        })
133
+        .catch(err => {
134
+          this.$notify.error(err.msg || err.message);
135
+        });
136
+    },
117 137
     verifyTel() {
138
+      if(this.verifyPhone === ""){
139
+        this.$notify.error("请输入手机号");
140
+        return;
141
+      }
118 142
       this.$router.push({
119 143
         name: "verify.list",
120 144
         params: { tel: this.verifyPhone }