Blame view

src/pages/confirmOrder/confirmOrder.vue 16 KB
026545fd8   BigBoss   样式调整
1
  <template>
edcf8c414   Adam   s
2
    <view class="wrap">
323398550   范牧   若干功能添加
3
      <view></view>
edcf8c414   Adam   s
4
5
      <view
        class="addAddress"
323398550   范牧   若干功能添加
6
7
        @tap="toaddAddress"
        v-if="this.showAddress"
edcf8c414   Adam   s
8
9
10
11
12
13
14
15
16
17
18
19
20
      >
        <view class="addIcon">
          <image
            src="../../static/add.png"
            mode="aspectFill"
          ></image>
        </view>
        <view class="addressText">{{addAddress}}</view>
        <image
          src="../../static/right.png"
          mode="aspectFill"
        ></image>
      </view>
323398550   范牧   若干功能添加
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
      <view
        v-else
        @tap="toaddAddress"
        class="list order-user"
      >
        <view class="order-user-head">
          <view class="name">
            <view
              v-if="addressInfo.default === '1'"
              class="default"
            ><text>默认</text></view>{{addressInfo.name}}
          </view>
          <text class="mobile">{{addressInfo.mobile}}</text>
        </view>
        <view class="order-user-body">
          <image src="../../static/myorder-paying-location.png"></image>
          <text class="address">{{addressInfo.address.replace(/[-]/g,' ')}}
  {{addressInfo.add_detail}}</text>
        </view>
        <image
          class="arrow"
          src="../../static/right.png"
        ></image>
      </view>
edcf8c414   Adam   s
45
46
47
48
49
50
51
52
53
54
55
56
      <view class="content">
        <view class="orderInfo">
          <view class="title">
            <image
              src="../../static/store.png"
              mode="aspectFill"
              style="width: 40rpx;height: 40rpx;"
            ></image>
            <text>非常戴镜</text>
          </view>
          <view class="infoBox">
            <view class="infoTop">
323398550   范牧   若干功能添加
57
58
59
60
              <image
                :src="goodInfo.img_index_url"
                mode="aspectFill"
              ></image>
edcf8c414   Adam   s
61
62
63
64
              <view class="infoRight">
                <text class="goodName">商品名称商品名称商品名称名称名称</text>
                <text class="remarks">支持7天无理由退货 顺丰发货</text>
                <view class="priceBox">
089dce19d   范牧   支付修改
65
                  <view class="price">¥{{Number(skuInfo.real_price) * count}}<text class="originCost">
3fb9af8d5   Adam   auto commit the c...
66
67
                      ¥{{parseInt(skuInfo.real_price * (1 + Number(skuInfo.discount) / 100))}}
                    </text></view>
edcf8c414   Adam   s
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
                  <view class="counter">
                    <view
                      class="btn"
                      disabled="this.disabled"
                      type="default"
                      @click="counter(false)"
                    >-</view>
                    <text>{{count}}</text>
                    <view
                      class="btn"
                      type="default"
                      @click="counter(true)"
                    >+</view>
                  </view>
                </view>
              </view>
            </view>
            <view class="infoBottom">
3fb9af8d5   Adam   auto commit the c...
86
87
88
89
90
91
92
              <view class="norm">规格 <text>
                  <!-- 长度超出变省略号未做 -->
                  <block
                    v-for="(item, index) in current"
                    :key="index"
                  >{{attrList[index].attr[item].name}}<block v-if="index !== current.length -1">/</block>
                  </block>
089dce19d   范牧   支付修改
93
                </text></view>
323398550   范牧   若干功能添加
94
              <view class="shippingMethod">配送方式 <text>快递</text></view>
edcf8c414   Adam   s
95
96
97
              <view class="message">买家留言
                <input
                  type="text"
323398550   范牧   若干功能添加
98
                  :value="note"
edcf8c414   Adam   s
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
                  placeholder="建议提前协商(50字以内)"
                />
              </view>
            </view>
          </view>
        </view>
        <view class="payWay">
          <view class="item">
            <text>支付方式</text>
            <view class="itemRight">
              <view class="rightText">
                <view class="choosePayWay">
                  <image
                    src="../../static/store.png"
                    mode="aspectFill"
                  ></image>
                  <text>微信支付</text>
                </view>
87eade409   范牧   验光数据填充检测
117
                <!-- <view class="randomSubstraction">最高随机立减¥99</view> -->
edcf8c414   Adam   s
118
              </view>
87eade409   范牧   验光数据填充检测
119
              <!-- <image
edcf8c414   Adam   s
120
121
                src="../../static/right.png"
                mode="aspectFill"
87eade409   范牧   验光数据填充检测
122
              ></image> -->
edcf8c414   Adam   s
123
124
            </view>
          </view>
87eade409   范牧   验光数据填充检测
125
          <!-- <view class="item">
edcf8c414   Adam   s
126
127
128
129
130
131
132
133
134
135
136
137
138
            <text>优惠券</text>
            <view class="itemRight">
              <view class="rightText">
                <view class="chooseOffers">
                  <text>-¥70.00</text>
                </view>
                <view class="preferentialWay">最大优惠</view>
              </view>
              <image
                src="../../static/right.png"
                mode="aspectFill"
              ></image>
            </view>
87eade409   范牧   验光数据填充检测
139
          </view> -->
edcf8c414   Adam   s
140
141
142
          <view class="item">
            <text>运费</text>
            <view class="itemRight">
87eade409   范牧   验光数据填充检测
143
              <view class="freight">免运费</view>
edcf8c414   Adam   s
144
145
146
147
148
            </view>
          </view>
          <view class="item">
            <text>合计</text>
            <view class="itemRight">
089dce19d   范牧   支付修改
149
              <view class="total">¥{{Number(skuInfo.real_price) * count}}</view>
edcf8c414   Adam   s
150
151
152
            </view>
          </view>
        </view>
323398550   范牧   若干功能添加
153
154
155
156
157
158
159
160
        <!--
        <view class="checkBox">
          <checkbox-group>
            <label>
              <checkbox color="#FF6B4A" value="isAnonymous" checked="true" />匿名购买
            </label>
          </checkbox-group>
        </view> -->
edcf8c414   Adam   s
161
162
      </view>
      <view class="footer">
089dce19d   范牧   支付修改
163
        <view class="footerLeft">实付金额:<text>¥{{Number(skuInfo.real_price) * count}}</text></view>
edcf8c414   Adam   s
164
        <view class="footerRight">
323398550   范牧   若干功能添加
165
166
167
168
          <view
            class="paybtn"
            @tap="orderBuild"
          >立即支付</view>
edcf8c414   Adam   s
169
170
171
        </view>
      </view>
    </view>
026545fd8   BigBoss   样式调整
172
173
174
  </template>
  
  <script>
3fb9af8d5   Adam   auto commit the c...
175
  import store from "@/store";
323398550   范牧   若干功能添加
176
  
edcf8c414   Adam   s
177
178
179
180
181
  export default {
    data() {
      return {
        addAddress: "添加收货地址",
        count: 1,
323398550   范牧   若干功能添加
182
        pid: 0,
edcf8c414   Adam   s
183
        disabled: false,
3fb9af8d5   Adam   auto commit the c...
184
        freight: 0.0,
323398550   范牧   若干功能添加
185
        showAddress: false,
3fb9af8d5   Adam   auto commit the c...
186
        note: "",
323398550   范牧   若干功能添加
187
        addressInfo: {
3fb9af8d5   Adam   auto commit the c...
188
189
          address: ""
        }
edcf8c414   Adam   s
190
191
192
        // isAnonymous:
      };
    },
089dce19d   范牧   支付修改
193
    onLoad({ pid, addressId, isCart }) {
3fb9af8d5   Adam   auto commit the c...
194
      this.pid = pid;
323398550   范牧   若干功能添加
195
196
      // 若已经选择地址
      if (addressId) {
3fb9af8d5   Adam   auto commit the c...
197
198
199
200
201
202
203
204
205
206
207
        store
          .dispatch("address/details", {
            add_id: addressId
          })
          .then(({ code, data }) => {
            if (code === 1) {
              console.log("code", code, data);
              this.showAddress = true;
              this.addressInfo = data;
            }
          });
323398550   范牧   若干功能添加
208
      } else {
3fb9af8d5   Adam   auto commit the c...
209
        store.dispatch("address/default").then(({ code, data }) => {
323398550   范牧   若干功能添加
210
          if (code === 1) {
3fb9af8d5   Adam   auto commit the c...
211
212
213
            console.log("code", code, data);
            this.showAddress = true;
            this.addressInfo = data;
323398550   范牧   若干功能添加
214
          }
3fb9af8d5   Adam   auto commit the c...
215
        });
323398550   范牧   若干功能添加
216
      }
3fb9af8d5   Adam   auto commit the c...
217
218
219
      store.dispatch("read/fetch", {
        pid
      });
323398550   范牧   若干功能添加
220
221
    },
    computed: {
3fb9af8d5   Adam   auto commit the c...
222
223
224
      goodInfo() {
        console.log("state", this.$store.state);
        return this.$store.state.read.goodInfo;
089dce19d   范牧   支付修改
225
      },
3fb9af8d5   Adam   auto commit the c...
226
227
      skuInfo() {
        return this.$store.state.order.param.sk_id_arr;
089dce19d   范牧   支付修改
228
      },
3fb9af8d5   Adam   auto commit the c...
229
230
      attrList() {
        return this.$store.state.order.param.attrList;
089dce19d   范牧   支付修改
231
      },
3fb9af8d5   Adam   auto commit the c...
232
233
234
      current() {
        return this.$store.state.order.param.current;
      }
323398550   范牧   若干功能添加
235
    },
edcf8c414   Adam   s
236
237
238
239
240
241
242
243
    methods: {
      counter(isadd) {
        if (isadd) {
          this.count++;
        } else {
          this.count <= 1 ? (this.disabled = true) : this.count--;
        }
      },
089dce19d   范牧   支付修改
244
      // 跳转添加地址页面
edcf8c414   Adam   s
245
246
      toaddAddress() {
        uni.navigateTo({
323398550   范牧   若干功能添加
247
          url: `../address/addressList?edit=${1}`,
edcf8c414   Adam   s
248
          success: res => {},
3fb9af8d5   Adam   auto commit the c...
249
250
251
          fail: error => {
            console.log("跳转到地址列表页面失败====>", error);
          },
edcf8c414   Adam   s
252
253
          complete: () => {}
        });
323398550   范牧   若干功能添加
254
      },
87eade409   范牧   验光数据填充检测
255
      // 下单
323398550   范牧   若干功能添加
256
      orderBuild() {
3fb9af8d5   Adam   auto commit the c...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
        console.log("this", this.$store.state);
        const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param;
        store
          .dispatch("order/buyNow", {
            pid: skId.pid,
            sk_id: skId.sk_id,
            number: this.count,
            mp_id: mpId,
            address: JSON.stringify(this.addressInfo),
            totalPrice: Number(this.skuInfo.real_price) * this.count * 100,
            liuyan: this.note,
            dir: 1
          })
          .then(res => {
            this.pay(res.data);
          });
089dce19d   范牧   支付修改
273
      },
87eade409   范牧   验光数据填充检测
274
      // 支付
089dce19d   范牧   支付修改
275
      pay(res) {
3fb9af8d5   Adam   auto commit the c...
276
277
278
        console.log("pay", res);
        const { data, exKeyName: keyName } = res;
        const uid = uni.getStorageSync("uid");
089dce19d   范牧   支付修改
279
280
281
282
283
284
285
        const fieldSet = {
          openid: this.$store.state.user.userInfo.openid,
          uid: this.$store.state.user.userInfo.uid,
          shopid: 0,
          payCate: 2020,
          payMoney: Number(this.skuInfo.real_price) * this.count * 100,
          payWoodId: `fcdj-${uid}-${keyName}`,
3fb9af8d5   Adam   auto commit the c...
286
287
          nonceStr: "asfafasfasfasfasf",
          signType: "MD5",
089dce19d   范牧   支付修改
288
289
290
          app_uid: 2020,
          timeStamp: new Date().getTime().toString(),
          billInfo: JSON.stringify(data),
3fb9af8d5   Adam   auto commit the c...
291
292
293
294
295
296
          keyname: keyName
        };
        console.log("fieldSet", fieldSet);
        store.dispatch("order/pay", fieldSet).then(res => {
          console.log("res", res);
        });
edcf8c414   Adam   s
297
298
299
      }
    }
  };
026545fd8   BigBoss   样式调整
300
301
  </script>
  
646a65287   BigBoss   确认订单页面
302
  <style lang="scss">
edcf8c414   Adam   s
303
304
305
306
307
  .wrap {
    height: 100vh;
    background-color: #f2f2f2;
    font-family: PingFangSC-Regular;
    letter-spacing: -0.23px;
323398550   范牧   若干功能添加
308
    position: absolute;
edcf8c414   Adam   s
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
  }
  .addAddress {
    background-color: #ffffff;
    box-sizing: border-box;
    height: 124rpx;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 40rpx;
    .addIcon {
      background-color: #f2f2f2;
      height: 56rpx;
      width: 60rpx;
      border-radius: 4rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      margin-right: 40rpx;
    }
    image {
      height: 28rpx;
      width: 28rpx;
    }
    .addressText {
      font-size: 28rpx;
      color: #333333;
      margin-right: 364rpx;
    }
  }
  .content {
    background-color: #f2f2f2;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40rpx;
    box-sizing: border-box;
    .orderInfo {
      width: 670rpx;
      height: 488rpx;
      background-color: #ffffff;
      border-radius: 20rpx;
      box-sizing: border-box;
      padding: 0 40rpx 40rpx 40rpx;
      .title {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        color: #333333;
        height: 60rpx;
        line-height: 40rpx;
        padding: 10rpx 10rpx 10rpx 0rpx;
        image {
          margin-right: 20rpx;
        }
      }
      .infoBox {
        margin-top: 42rpx;
        .infoTop {
          display: flex;
          flex-direction: row;
          image {
            height: 188rpx;
            width: 188rpx;
            margin-right: 24rpx;
          }
          .infoRight {
            width: 374rpx;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: space-between;
            .goodName {
              font-size: 28rpx;
              color: #333333;
            }
            .remarks {
              font-size: 20rpx;
              color: #999999;
            }
            .priceBox {
              display: flex;
              justify-content: space-between;
              align-items: center;
              width: 100%;
              .price {
                color: #ff6b4a;
                font-size: 28rpx;
              }
089dce19d   范牧   支付修改
399
400
401
402
403
              .originCost {
                text-decoration: line-through;
                color: #999999;
                font-size: 20rpx;
              }
edcf8c414   Adam   s
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
              .counter {
                display: flex;
                flex-direction: row;
                justify-content: space-between;
                font-size: 28rpx;
                color: #333333;
                width: 122rpx;
                .btn {
                  display: flex;
                  justify-content: center;
                  line-height: 32rpx;
                  height: 32rpx;
                  width: 32rpx;
                  background-color: #f2f2f2;
                  color: #cfcfcf;
                }
              }
            }
          }
        }
        .infoBottom {
          display: flex;
          flex-direction: column;
          justify-content: flex-start;
          font-size: 24rpx;
          color: #333333;
          text {
            color: #999999;
            margin-left: 20rpx;
          }
  
          .norm {
            margin-top: 28rpx;
          }
          .shippingMethod {
            margin-top: 12rpx;
          }
          .message {
            display: flex;
            flex-direction: row;
            align-items: center;
            margin-top: 18rpx;
            input {
              margin-left: 20rpx;
              width: 75%;
            }
          }
        }
      }
    }
    .payWay {
      height: 464rpx;
      width: 670rpx;
      background-color: #ffffff;
      color: #333333;
      font-size: 24rpx;
      border-radius: 20rpx;
      box-sizing: border-box;
      padding: 0 52rpx 0rpx 40rpx;
      margin-top: 20rpx;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: flex-start;
      .item {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        height: 115rpx;
        .itemRight {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          align-items: center;
          image {
            height: 24rpx;
            width: 12rpx;
          }
          .rightText {
            margin-right: 20rpx;
            text-align: right;
            .choosePayWay {
              text {
                color: #333333;
              }
              image {
                height: 26rpx;
                width: 30rpx;
                margin-right: 20px;
              }
            }
            .randomSubstraction {
              color: #ff6b4a;
            }
            .preferentialWay {
              color: #999999;
            }
          }
          .freight,
          .total {
            margin-right: 32rpx;
          }
          text {
            color: #ff6b4a;
          }
        }
      }
    }
323398550   范牧   若干功能添加
514
515
516
517
518
519
520
521
    // .checkBox {
    //   height: 58rpx;
    //   line-height: 58rpx;
    //   width: 100%;
    //   margin-top: 36rpx;
    //   margin-left: 40rpx;
    //   font-size: 12px;
    //   color: #999999;
edcf8c414   Adam   s
522
523
524
525
526
    // }
  }
  .footer {
    height: 112rpx;
    width: 100%;
323398550   范牧   若干功能添加
527
    background-color: #fff;
edcf8c414   Adam   s
528
529
530
531
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
323398550   范牧   若干功能添加
532
533
    position: fixed;
    bottom: 0;
edcf8c414   Adam   s
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
    .footerLeft {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 50%;
      color: #333333;
      text {
        color: #ff6b4a;
      }
    }
    .footerRight {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      width: 50%;
      margin-right: 26rpx;
      .paybtn {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #ff6b4a;
        border-radius: 20px;
        border-radius: 20px;
        color: #ffffff;
        width: 204rpx;
        height: 80rpx;
      }
    }
  }
323398550   范牧   若干功能添加
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
  // 地址信息样式
  .order-user {
    width: 670rpx;
    height: 228rpx;
    background: #ffffff;
    border-radius: 14rpx;
    margin: 0 auto;
    margin-top: 20rpx;
    position: relative;
    .order-user-head {
      display: flex;
      height: 108rpx;
      width: 100%;
      align-items: center;
      margin-left: 126rpx;
      .name {
        display: flex;
        justify-content: space-between;
        font-size: 14px;
        color: #333333;
        letter-spacing: -0.26px;
        margin-right: 20rpx;
        .default {
          height: 40rpx;
          width: 80rpx;
          background-color: #4a90e2;
          border-radius: 13px;
          border-radius: 13px;
          text-align: center;
          margin-right: 20rpx;
          text {
            font-size: 12px;
            color: #ffffff;
            letter-spacing: -0.23px;
          }
        }
      }
      .mobile {
        font-size: 14px;
        color: #999999;
        letter-spacing: -0.26px;
      }
    }
    .order-user-body {
      display: flex;
      width: 100%;
      image {
        width: 24px;
        height: 26px;
        margin: 12rpx 32rpx 0 40rpx;
      }
      .address {
        font-weight: bold;
        font-size: 14px;
        color: #333333;
        letter-spacing: -0.26px;
      }
    }
    .arrow {
      width: 6px;
      height: 12px;
      position: absolute;
      right: 40rpx;
      bottom: 104rpx;
    }
  }
026545fd8   BigBoss   样式调整
629
  </style>