quanwei
2025-11-15 6f12eadd25c8f5335fd9eccf373bf9835bf3e4c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
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
399
400
401
402
403
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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
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
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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
<template>
    <view class="wrap" :data-theme='theme()' :class="theme() || ''" v-if="!loading">
        <Myinfo v-if="ProductData[0].productList[0].is_virtual != 2" :dis="options.order_type == 'retainage'" :Address="Address" :exist_address="exist_address"></Myinfo>
        <!--购买的产品-->
        <view class="vender">
            <view class="list">
                <view v-for="(supplier_item, supplier_index) in ProductData" :key="supplier_index">
                    <view class="sup_itemtit" v-if="store_open">
                        <i class="icon iconfont icon-dianpu1"></i>
                        <view class="f26 gray3">
                            {{supplier_item.supplier.name}}
                        </view>
                    </view>
                    <view class="item" v-for="(item, index) in supplier_item.productList" :key="index">
                        <view class="d-f">
                            <view class="cover">
                                <image :src="item.product_image" mode="aspectFit"></image>
                            </view>
                            <view class="info">
                                <view class="d-b-s">
                                    <view class="flex-1">
                                        <view class="title f32 gray3">{{ item.product_name }}</view>
                                        <view class="theme-price mt10 f18">
                                            ¥<text class="f26">{{ item.product_price }}</text>
                                        </view>
                                        <view class="describe mt10 f24" v-if="options.order_type=='deposit'">
                                            {{ item.advance_sku.product_attr }}</view>
                                        <view class="describe mt10 f24" v-else-if="options.order_type=='retainage'">
                                            {{ item.product_attr }}</view>
                                        <view class="describe mt10 f24" v-else>{{ item.product_sku.product_attr }}
                                        </view>
                                    </view>
                                    <view>
                                        <view class=" count_choose">
                                            <view class="num-wrap">
                                                <view class="f22 tr">×{{ item.total_num }}</view>
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <view class="mt10 tr f28" v-if="item.is_user_grade==true">
                            <text class="f26">会员折扣价:</text>
                            <text class="theme-price f32">¥{{item.grade_product_price}}</text>
                        </view>
                        <view class="mt10 tr f28" v-if="item.product_reduce_money > 0">
                            <text class="f26">立减:</text>
                            <text class="theme-price f32">¥{{item.product_reduce_money}}</text>
                        </view>
                    </view>
                    
                    <Verifystoreinfo v-if="supplier_item.orderData.delivery==30 && supplier_item.productList[0].is_virtual == 1" ref="getShopinfoData" :extract_store="extract_store"
                     :last_extract="last_extract" :verify_data="verify_data"></Verifystoreinfo>
 
                    <view class="d-f-c">
                        <view class="flex-1" v-if="supplier_item.orderData.delivery==10" @tap="DistUp(supplier_item)">
                            <text class="zt theme-btn">配送方式</text> <text class="extp">普通快递</text>
                        </view>
                        <view class="flex-1" v-if="supplier_item.orderData.delivery==20" @tap="DistUp(supplier_item)">
                            <view class="info d-s-s" style="padding-left: 0;">
                                <text class="zt theme-btn">当前自提点</text>
                                <view class="province-c-a d-s-s flex-1">
                                    <!-- <text>{{ store_list[supplier_item.shop_supplier_id]}}</text> -->
                                    <view v-if="store_list[supplier_item.shop_supplier_id]">
                                        <view class="f28">{{store_list[supplier_item.shop_supplier_id].store_name}}</view>
                                        <view class="gray9">{{store_list[supplier_item.shop_supplier_id].address}}</view>
                                    </view>
                                    <view v-else>请选择自提点!</view>
                                </view>
                            </view>
                        </view>
                        <view class="flex-1" v-if="supplier_item.orderData.delivery==40" @tap="DistUp(supplier_item)">
                            <view class="info d-s-s" style="padding-left: 0;">
                                <text class="zt theme-btn">门店配送</text>
                                <view class="province-c-a d-s-s flex-1">
                                    <view v-if="!exist_address">请先设置您的收货地址</view>
                                    <view v-else-if="delivery_store_list[supplier_item.shop_supplier_id]">
                                        <view class="f28">{{delivery_store_list[supplier_item.shop_supplier_id].store_name}}</view>
                                        <view class="gray9">{{delivery_store_list[supplier_item.shop_supplier_id].address}}</view>
                                    </view>
                                    <view v-else>您的收货地址已超出门店配送范围!</view>
                                </view>
                            </view>
                        </view>
                        <view v-if="supplier_item.orderData.delivery==30">
                            虚拟商品:无需物流
                        </view>
                        <view class="dfjac" v-if="supplier_item.orderData.delivery!=30" @tap="DistUp(supplier_item)">
                            <view v-if="supplier_item.orderData.delivery==10">
                                {{supplier_item.orderData.express_price != 0?"¥ "+supplier_item.orderData.express_price:"快递 免费"}}
                            </view>
                            <i class='iconfont icon-jiantou'></i>
                        </view>
                    </view>
                    
                    <template v-if="options.order_type == 'deposit'">
                        <view class="d-f-c">
                            <text class="key f26">定金:</text>
                            <view class="f24">¥{{ OrderData.order_total_front_price }}</view>
                        </view>
                        <view class="d-f-c">
                            <text class="key f26">尾款:</text>
                            <view class="f24">
                                ¥{{ OrderData.order_total_pay_price }}</view>
                        </view>
                        <view class="f-d-c p30">
                            <view class="ww100 d-e-c red">(单件商品尾款已减{{OrderData.reduce_money}}元)
                            </view>
                            <view class="ww100 d-e-c gray9">
                                {{supplier_item.productList[0].advance.active_time[0]}}-{{supplier_item.productList[0].advance.active_time[1]}}支付尾款
                            </view>
                        </view>
                    </template>
                    <template v-else>
                        
                    <view class="d-f-c" v-if="!OrderData.force_points">
                        <view class="">优惠券</view>
                        <block v-if="objKeys(supplier_item.orderData.couponList,1) > 0">
                            <text class="vlaue theme-price" v-if="supplier_item.orderData.coupon_money> 0"
                                @tap="onTogglePopupCoupon(supplier_item.orderData.couponList,supplier_item)">-¥{{supplier_item.orderData.coupon_money}}</text>
                            <text v-else class="vlaue theme-price"
                                @tap="onTogglePopupCoupon(supplier_item.orderData.couponList,supplier_item)">有{{ objKeys(supplier_item.orderData.couponList,1)}}张优惠券可用<i
                                    class='iconfont icon-jiantou'></i></text>
                        </block>
                        <text v-else class="f24 gray9">无优惠券可用</text>
                    </view>
                    <view class="d-f-c" v-if="supplier_item.orderData.reduce">
                        <view>店铺{{supplier_item.orderData.reduce.active_name}}</view>
                        <view class="theme-price f24">
                            -¥{{supplier_item.orderData.reduce.reduced_price}}
                        </view>
                    </view>
                        <view class="d-f-c" v-if="supplier_item.orderData.reduce_money">
                            <view>尾款抵扣:</view>
                            <view class="theme-price f24">
                                -¥{{supplier_item.orderData.reduce_money}}
                            </view>
                        </view>
                        <view v-if="is_use_points==1&&!OrderData.force_points&&supplier_item.orderData.points_money>0">
                            <view class="d-f-c">
                                <view>{{points_name()}}抵扣金额</view>
                                <view class="theme-price f24">-¥{{supplier_item.orderData.points_money}}</view>
                            </view>
                        </view>
                        <view class="d-f-c">
                            <view class="ww100">
                                <view class="mb20">订单备注</view>
                                <view class="ww100"><textarea
                                        v-model="store_data[supplier_item.shop_supplier_id].remark"
                                        placeholder="选填,请先和商家协商一致" class="text_area" /></view>
                            </view>
                        </view>
                        <!--总数-->
                        <view class="total-box vthl">
                            <view>
                                <text class="f26 gray3">共{{supplier_item.productList.length}}件商品,总价:</text>
                                <text class="f20 gray3">¥</text>
                                <text class="f26 gray3">{{ supplier_item.orderData.order_total_price }}</text>
                            </view>
                            <view class="d-f">
                                <view class="f26" v-if="!OrderData.force_points">
                                    实付款:<text class="theme-price f20">¥</text><text class="price theme-price"
                                        style="font-size: 32rpx;">{{toDecimal2(supplier_item.orderData.order_pay_price)}}</text>
                                </view>
                            </view>
                        </view>
                    </template>
 
                </view>
            </view>
        </view>
        <!--其它费用-->
        <view class="buy-checkout" v-if="options.order_type != 'deposit'">
            <view class="item">
                <text class="key f26">订单总金额:</text>
                <view>
                    <text class="theme-price f24">¥{{ OrderData.order_total_price }}</text>
                </view>
            </view>
            <view class="item f26" v-if="OrderData.is_coupon">
                <text class="key">平台优惠券:</text>
                <block v-if="coupon_num > 0">
                    <text class="f24  theme-price" v-if="OrderData.coupon_money_sys > 0"
                        @tap="onTogglePopupCoupon(coupon_list,0)">-¥{{OrderData.coupon_money_sys}}</text>
                    <text v-else class="f24  theme-price"
                        @tap="onTogglePopupCoupon(coupon_list,0)">有{{ coupon_num }}张优惠券可用</text>
                </block>
                <text v-else class="f24 gray9">无优惠券可用</text>
            </view>
            <view class="item" v-if="OrderData.product_reduce_money > 0">
                <text class="key">商品立减:</text>
                <view>
                    <text class="theme-price f24">-¥{{ OrderData.product_reduce_money }}</text>
                </view>
            </view>
            <view class="item" v-if="OrderData.reduce_money">
                <text class="key">尾款抵扣:</text>
                <view>
                    <text class="theme-price f24">-¥{{ OrderData.reduce_money }}</text>
                </view>
            </view>
            <view class="item"
                v-if="OrderData.is_allow_points && OrderData.force_points == false &&OrderData.points_money != 0">
                <text class="key">可用{{points_name()}}抵扣:</text>
                <view class="">
                    <text class="theme-price f24">-¥{{toDecimal2(OrderData.points_money)}}</text>
                    <switch style="transform: scale(0.7); margin-right: -10rpx;" checked=true @change="onShowPoints" />
                </view>
            </view>
        </view>
        <!--底部支付-->
        <view class="foot-pay-btns">
            <template v-if="options.order_type=='deposit'">
                <view>
                    应付
                    <text class="fb theme-price">¥</text>
                    <text class="num theme-price fb f38">{{ OrderData.order_total_front_price }}</text>
                </view>
            </template>
            <template v-else>
                <view class="price" v-if="!OrderData.force_points">
                    ¥
                    <text class="num">{{ OrderData.order_pay_price }}</text>
                </view>
                <view class="price" v-if="OrderData.force_points">
                    <text class="gray9">所需{{points_name()}}</text>
                    <text class="num theme-price fb">{{ ProductData[0].orderData.points_num }}</text>
                </view>
            </template>
            <button type="primary" @tap="SubmitOrder">提交订单</button>
        </view>
 
        <!--优惠券-->
        <Coupon :isCoupon="isCoupon" :couponList="couponList" @close="closeCouponFunc"></Coupon>
        <Dist :isDist="isDist" :chooseSotr="chooseSotr" @close="closeDistFunc" :extract_store="extract_store"
            :last_extract="last_extract" :deliverySetting="deliverySetting"></Dist>
 
    </view>
</template>
 
<script>
    import uniPopup from '@/components/uni-popup.vue';
    import Myinfo from './confirm-order/my-info';
    import Storeinfo from './confirm-order/store-info';
    import Verifystoreinfo from './confirm-order/verify-store-info'; //核销门店
    import Coupon from './confirm-order/coupon';
    import Dist from './confirm-order/distr';
    import {
        pay
    } from '@/common/pay.js';
 
    export default {
        components: {
            Myinfo,
            Storeinfo,
            Coupon,
            Dist,
            Verifystoreinfo
        },
        data() {
            return {
                /*是否加载完成*/
                loading: true,
                options: {},
                indicatorDots: true,
                autoplay: true,
                interval: 2000,
                duration: 500,
                /*商品id*/
                product_id: '',
                /*商品数量*/
                product_num: '',
                /*商品数据*/
                ProductData: [],
                /*订单数据数据*/
                OrderData: [],
                // 是否存在收货地址
                exist_address: false,
                /*默认地址*/
                Address: {
                    region: []
                },
                extract_store: [],
                last_extract: {},
                product_sku_id: 0,
                /*配送方式*/
                delivery: 10,
                /*自提店id*/
                store_id: 0,
                /*优惠券id*/
                coupon_id: -1,
                /*是否使用积分,默认使用*/
                is_use_points: 1,
                remark: '',
                /*支付方式*/
                pay_type: 20,
                /*是否显示优惠券*/
                isCoupon: false,
                /*优惠券列表*/
                coupon_list: {},
                couponList: [],
                /*优惠券数量*/
                coupon_num: 0,
                /* 是否显示配送方式 */
                isDist: false,
                /*消息模板*/
                temlIds: [],
                /* 选择的地址 */
                // chooseAd:''
                product_couponid: 0,
                chooseSotr: 0,
                /* 支持的配送方式 */
                deliverySetting: [],
                choose_delivery: 10,
                store_data: {},
                // 当前店铺选择的门店
                choose_store_id: 0,
                store_list: {},
                room_id: '',
                /*是否显示支付宝支付,只有在h5,非微信内打开才显示*/
                showAlipay: false,
                balance:'',
                store_open: 1,
                addressZb:{
                    lng:'',
                    lat:''
                },
                over_distance:true,
                delivery_store:{},
                delivery_store_list: {},
                verify_data: [] ,//虚拟商品 核销数据
            };
        },
        onLoad(options) {
            let self = this;
            self.options = options;
            self.room_id = options.room_id ? options.room_id : 0;
            self.$fire.on('selectStoreId', function(e) {
                self.extract_store = e;
                self.choose_store_id = e.store_id;
            });
            self.$fire.on('checkedfir', function(n) {
                self.choose_delivery = n;
            });
            self.$fire.on('selectStoreId', function(store_id) {
                self.store_id = store_id;
                self.extract_store=store_id;
            });
            self.$fire.on('extract', function(params) {
                console.log(params);
                self.last_extract = params;
            });
            self.$fire.on('overAddress', function(overAddress) {
                self.overAddress = overAddress;
            });
        },
        onShow() {
            this.getData();
        },
        mounted() {},
        methods: {
            /*获取数据*/
            getAddressData(shop_supplier_id) {
                let self = this;
                console.log(self.addressZb.lng);
                self._get('store.store/lists', {
                    longitude: self.addressZb.lng,
                    latitude: self.addressZb.lat,
                    shop_supplier_id:shop_supplier_id,
                    url: '',
                    is_check: false // 不支持自提的门店也列出 by lyzflash
                }, function(res) {
                    var storeList = res.data.list;
                    console.log(storeList);
                    self.delivery_store = {};
                    self.over_distance = true;
                    self.delivery_store = {};
                    self.delivery_store_list[shop_supplier_id] = '';
                    self.store_data[shop_supplier_id]['store_id'] = 0;
                    if(storeList.length > 0){
                        if(storeList[0].distance <= Number(storeList[0].delivery_scope)*1000){
                            self.over_distance = false;
                            self.delivery_store = storeList[0];
                            self.delivery_store_list[shop_supplier_id] = {store_name: storeList[0].store_name, address: storeList[0].address};
                            self.store_data[shop_supplier_id]['store_id'] = storeList[0].store_id;
                        }
                    }
                });
            },
            init() {
                let key = '';
                let value = "";
                let self = this;
                self.ProductData.forEach((item, index) => {
                    key = item.shop_supplier_id;
                    value = {
                        coupon_id: item.orderData.coupon_id,
                        delivery: item.orderData.delivery,
                        store_id: 0,
                        remark: ""
                    }
                    self.store_data = {
                        ...self.store_data,
                        [key]: value
                    }
                })
            },
            /**/
            hasType(e) {
                if (this.deliverySetting.indexOf(e) != -1) {
                    return true;
                } else {
                    return false;
                }
            },
            /*支付方式选择*/
            payTypeFunc(e) {
                this.pay_type = e;
            },
            /*是否使用积分选择*/
            onShowPoints: function(e) {
                let self = this;
                if (e.target.value == true) {
                    self.is_use_points = 1;
                } else {
                    self.is_use_points = 0;
                }
                self.getData();
            },
            /*选择优惠卷*/
            onTogglePopupCoupon(e, id) {
                let self = this;
                if (id != 0) {
                    self.chooseSotr = id.shop_supplier_id;
                } else {
                    self.chooseSotr = 0;
                }
                self.isCoupon = true;
                self.couponList = e;
            },
            /*关闭优惠券*/
            closeCouponFunc(e) {
                let self = this;
                if (e && typeof e != 'number') {
                    self.isCoupon = false;
                    return;
                }
                if (self.chooseSotr != 0) {
                    let storid = self.chooseSotr;
                    if (e > 0) {
                        self.store_data[storid].coupon_id = e;
                    } else {
                        self.store_data[storid].coupon_id = 0;
                    }
                    self.chooseSotr = 0;
                } else {
                    if (e > 0) {
                        self.coupon_id = e;
                    } else {
                        self.coupon_id = 0;
                    }
 
                }
                self.isCoupon = false;
                self.getData();
            },
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
 
                let callback = function(res) {
                    self.OrderData = res.data.orderInfo.orderData;
                    self.temlIds = res.data.template_arr;
                    self.exist_address = self.OrderData.exist_address;
                    self.Address = self.OrderData.address;
                    self.verify_data = self.OrderData.verify_data;
                    //self.last_extract = self.OrderData.last_extract;
                    self.last_extract = uni.getStorageSync('extract');
                    if(!self.last_extract){
                        self.last_extract = self.OrderData.last_extract;
                    }
                    self.ProductData = res.data.orderInfo.supplierList;
                    if (self.options.order_type != 'deposit') {
                        self.coupon_list = self.OrderData.coupon_list;
                        self.coupon_id = self.OrderData.coupon_id_sys;
                        self.coupon_num = Object.keys(self.coupon_list).length;
                    }
                    self.balance=res.data.balance;
 
                    if(self.ProductData.length>0 && JSON.stringify(self.store_data) == "{}"){
                        self.delivery=self.ProductData[0].orderData.delivery;
                        self.choose_delivery=self.ProductData[0].orderData.delivery;
                    }
                    // 需循环获取每个商户的门店配送
                    if(res.data.addressZb){
                        self.addressZb = res.data.addressZb;
                        self.ProductData.forEach((item, index) => {
                            item.orderData.delivery == 40 && self.getAddressData(item.shop_supplier_id);
                        });
                    }
                    
                    //#ifdef MP-WEIXIN
                    self.store_open = res.data.store_open;
                    //#endif
                    if (self.OrderData.order_pay_price == 0) {
                        self.pay_type = 10;
                    }
                    if (JSON.stringify(self.store_data) == "{}") {
                        self.init()
                    }
                    if (res.data.show_alipay) {
                        self.showAlipay = true;
                    }
                    self.loading = false;
                };
 
                // 请求的参数
                let params = {
                    delivery: self.delivery,
                    store_id: self.store_id,
                    coupon_id: self.coupon_id,
                    is_use_points: self.is_use_points,
                    // pay_source: self.getPlatform()
                    pay_source: 'android'
                };
                if (JSON.stringify(self.store_data) == "{}") {
                    params = params;
                } else {
                    params = {
                        ...params,
                        supplier: self.store_data
                    };
                }
                //直接购买
                if (self.options.order_type === 'buy') {
                    self._get(
                        'order.order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    product_id: self.options.product_id,
                                    product_num: self.options.product_num,
                                    product_sku_id: self.options.product_sku_id,
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                //定金
                else if (self.options.order_type === 'deposit') {
                    let test = Object.assign({}, params, {
                        product_id: self.options.product_id,
                        product_num: self.options.product_num,
                        product_sku_id: self.options.product_sku_id,
                        advance_product_sku_id: self.options.advance_product_sku_id,
                        advance_product_id: self.options.advance_product_id
                    })
                    console.log(test)
                    self._get(
                        'plus.advance.Order/frontBuy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    product_id: self.options.product_id,
                                    product_num: self.options.product_num,
                                    product_sku_id: self.options.product_sku_id,
                                    advance_product_sku_id: self.options.advance_product_sku_id,
                                    advance_product_id: self.options.advance_product_id
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                //尾款
                else if (self.options.order_type === 'retainage') {
                    self._get(
                        'plus.advance.Order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    order_id: self.options.order_id,
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                // 购物车结算
                else if (self.options.order_type === 'cart') {
                    self._get(
                        'order.order/cart', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    cart_ids: self.options.cart_ids || 0
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                // 积分兑换结算
                else if (self.options.order_type == 'points') {
                    console.log(self.options);
                    self._get(
                        'plus.points.order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    point_product_id: self.options.point_product_id,
                                    product_sku_id: self.options.product_sku_id,
                                    point_product_sku_id: self.options.point_product_sku_id,
                                    product_num: self.options.product_num
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                // 限时秒杀
                else if (self.options.order_type === 'seckill') {
                    params.num = self.options.num;
                    self._get(
                        'plus.seckill.order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    seckill_product_id: self.options.seckill_product_id,
                                    product_sku_id: self.options.product_sku_id,
                                    seckill_product_sku_id: self.options.seckill_product_sku_id,
                                    product_num: self.options.product_num
                                }))
                        }
 
                        ,
                        function(res) {
                            callback(res);
                        }
                    );
                }
                //砍价
                else if (self.options.order_type === 'bargain') {
                    self._get(
                        'plus.bargain.order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    bargain_product_id: self.options.bargain_product_id,
                                    product_sku_id: self.options.product_sku_id,
                                    bargain_product_sku_id: self.options.bargain_product_sku_id,
                                    bargain_task_id: self.options.bargain_task_id
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
                //拼团
                else if (self.options.order_type === 'assemble') {
                    self._get(
                        'plus.assemble.order/buy', {
                            params: JSON.stringify(
                                Object.assign({}, params, {
                                    assemble_product_id: self.options.assemble_product_id,
                                    product_sku_id: self.options.product_sku_id,
                                    assemble_product_sku_id: self.options.assemble_product_sku_id,
                                    product_num: self.options.product_num,
                                    assemble_bill_id: self.options.assemble_bill_id,
                                })
                            )
                        },
                        function(res) {
                            callback(res);
                        }
                    );
                }
            },
 
            toDecimal2(x) {
                var f = parseFloat(x);
                if (isNaN(f)) {
                    return "0.00";
                }
                var f = Math.round(x * 100)
                var n = Math.round(x * 1000)
                var r = n.toString().split("");
                r = r[r.length - 1];
                if (r >= 5) {
                    f = (f - 1) / 100
                } else {
                    f = f / 100
                }
                var s = f.toString();
                var rs = s.indexOf('.');
                if (rs < 0) {
                    rs = s.length;
                    s += '.';
                }
                while (s.length <= rs + 2) {
                    s += '0';
                }
                return s;
            },
            /* 配送选择 */
            DistUp(item) {
                let self = this;
                if (!self.exist_address) {
                    uni.showToast({
                        title: '请先添加您的地址',
                        icon: 'none'
                    });
                    return;
                }
                self.store_id = item.shop_supplier_id;
                self.chooseSotr = item.shop_supplier_id;
                self.choose_delivery = item.orderData.delivery;
                let storid = self.chooseSotr;
                self.getData();
                //self.deliverySetting = item.orderData.deliverySetting;
                self.deliverySetting = item.orderData.deliverySetting.toString();
                self.extract_store = item.orderData.extract_store;
                this.isDist = true;
 
            },
            /* 关闭配送选择 */
            closeDistFunc(e) {
                console.log(2)
                let self = this;
                self.choose_delivery = e;
                self.isDist = false;
                self.delivery = self.choose_delivery;
                                  
                let storid = self.chooseSotr;
                let choose_store_id = self.choose_store_id;
                if (self.extract_store.region) {
                    // let storname = self.extract_store.store_name + '[' + self.extract_store.region.province + self.extract_store.region.city + self.extract_store.region.region + ']';
                    // self.store_list[storid] = storname;
                    self.store_list[storid] = {store_name: self.extract_store.store_name, address: self.extract_store.region.province + self.extract_store.region.city + self.extract_store
                    .region.region + self.extract_store.address};
                }
                self.store_id = storid;
                self.store_data[storid].store_id = choose_store_id;
                self.store_data[storid].delivery = self.choose_delivery;
 
                self.chooseSotr = 0;
                
                self.getData();
            },
            objKeys(obj, n) {
                if (obj) {
                    if (n == 1) {
                        return Object.keys(obj).length
                    } else {
                        return Object.keys(obj)
                    }
                }
 
            },
            /*提交订单*/
            SubmitOrder() {
                let self = this;
                //券商品
                var is_virtual = self.ProductData[0].productList[0].is_virtual;
                if (is_virtual==2 || self.exist_address) {
                    // 需循环判断配送方式 by lyzflash
                    let delivery_ok = true;
                    Object.keys(self.store_data).forEach(function(key) {
                        if ((self.store_data[key].delivery == 20 || self.store_data[key].delivery == 40) && self.store_data[key].store_id == 0) {
                            delivery_ok = false;
                        }
                    });
                    if (!delivery_ok) {
                        uni.showToast({
                            title: '有配送方式未设置正确,请检查',
                            icon:'none'
                        })
                        return;
                    }
                    uni.showLoading({
                        title: '加载中',
                        mask: true
                    });
                    
                    let params = {
                        pay_type: self.pay_type,
                        room_id: self.room_id,
                        coupon_id: self.coupon_id,
                        is_use_points: self.is_use_points,
                        // pay_source: self.getPlatform()
                    };
 
                    params = Object.assign(params, {
                        supplier: self.store_data
                    });
 
                    // 创建订单-直接下单
                    let url = '';
                    if (self.options.order_type === 'buy') {
                        url = 'order.order/buy';
                        params = Object.assign(params, {
                            product_id: self.options.product_id,
                            product_num: self.options.product_num,
                            product_sku_id: self.options.product_sku_id,
                            room_id: self.options.room_id || 0
                        });
                        params = JSON.stringify(params)
                    }
                    if (self.options.order_type === 'deposit') {
                        url = 'plus.advance.Order/frontBuy';
                        params = Object.assign(params, {
                            product_id: self.options.product_id,
                            product_num: self.options.product_num,
                            product_sku_id: self.options.product_sku_id,
                            advance_product_sku_id: self.options.advance_product_sku_id,
                            advance_product_id: self.options.advance_product_id
                        });
                        params = JSON.stringify(params)
                    }
                    if (self.options.order_type === 'retainage') {
                        url = 'plus.advance.Order/buy';
                        params = Object.assign(params, {
                            order_id: self.options.order_id,
                        });
                        params = JSON.stringify(params)
                    }
                    // 创建订单-购物车结算
                    if (self.options.order_type === 'cart') {
                        url = 'order.order/cart';
                        params = Object.assign(params, {
                            cart_ids: self.options.cart_ids || 0,
                            // video_id: self.options.video_id || 0,
                            room_id: self.options.room_id || 0
                        });
                        params = JSON.stringify(params)
                    }
 
                    // 创建订单-积分兑换
                    if (self.options.order_type === 'points') {
                        url = 'plus.points.order/buy';
                        params = Object.assign(params, {
                            point_product_id: self.options.point_product_id,
                            product_sku_id: self.options.product_sku_id,
                            point_product_sku_id: self.options.point_product_sku_id,
                            product_num: self.options.product_num
                        });
                        params = JSON.stringify(params)
                    }
                    // 创建订单-限时秒杀
                    if (self.options.order_type === 'seckill') {
                        url = 'plus.seckill.order/buy';
                        params.num = self.options.num;
                        params = Object.assign(params, {
                            seckill_product_id: self.options.seckill_product_id,
                            product_sku_id: self.options.product_sku_id,
                            seckill_product_sku_id: self.options.seckill_product_sku_id,
                            product_num: self.options.product_num
                        });
                        params = JSON.stringify(params)
                    }
                    // 创建订单-砍价
                    if (self.options.order_type === 'bargain') {
                        url = 'plus.bargain.order/buy';
                        params = Object.assign(params, {
                            bargain_product_id: self.options.bargain_product_id,
                            product_sku_id: self.options.product_sku_id,
                            bargain_product_sku_id: self.options.bargain_product_sku_id,
                            bargain_task_id: self.options.bargain_task_id
                        });
                        params = JSON.stringify(params)
                    }
 
                    // 创建订单-限时拼团
                    if (self.options.order_type === 'assemble') {
                        url = 'plus.assemble.order/buy';
                        params = Object.assign(params, {
                            assemble_product_id: self.options.assemble_product_id,
                            product_sku_id: self.options.product_sku_id,
                            assemble_product_sku_id: self.options.assemble_product_sku_id,
                            assemble_bill_id: self.options.assemble_bill_id,
                            product_num: self.options.product_num,
                        });
                        params = JSON.stringify(params)
                    }
 
                    let callback = function() {
                        self._post(url, {
                            params
                        }, function(res) {
                            let ids = '';
                            let pages = '';
                            if (self.options.order_type == 'deposit') {
                                pages = '/pages/order/cashier?order_type=50&order_id=' + res.data.order_id;
                            } else if (self.options.order_type == 'retainage') {
                                ids = res.data.order_id;
                                pages = '/pages/order/cashier?order_type=10&order_id=' + ids;
                            } else {
                                ids = encodeURIComponent(res.data.order_id.join(','));
                                pages = '/pages/order/cashier?order_type=10&order_id=' + ids;
                            }
                            console.log(pages)
                            self.gotoPage(pages,'reLaunch');
                        });
                    };
 
                    self.subMessage(self.temlIds, callback);
                } else {
                    uni.showToast({
                        title: '请选择配送地址'
                    })
                }
            },
        }
    };
</script>
 
<style lang="scss">
    page{
        background-color: #F2F2F2;
    }
 
    .f-d-c {
        flex-direction: column;
    }
 
    .wrap {
        padding-bottom: 110rpx;
    }
 
    .d-f-c {
        display: flex;
        justify-content: space-between;
        align-items: center;
        overflow: hidden;
        padding:30rpx 0;
        margin: 0 30rpx;
        font-size: 24rpx;
        border-bottom: 1rpx solid #EEEEEE;
    }
 
    .dfjac {
        display: flex;
        align-items: center;
    }
 
    .d-txar {
        white-space: nowrap;
        width: 200px;
        margin-right: 34rpx;
    }
 
    .extp {
        color: #9e9e9e;
        margin-left: 34rpx;
    }
 
    .vender .list .item {
        border-bottom: none;
    }
 
    .icon-jiantou {
        margin-left: 15rpx;
    }
 
    .icon-dianpu1 {
        margin-right: 15rpx;
        font-size: 28rpx;
        color: #333333;
    }
 
    .sup_itemtit {
        padding: 40rpx 30rpx;
        display: flex;
        align-items: center;
    }
 
    .vender .total-box {
        height: 87rpx;
        line-height: 87rpx;
        border-bottom: 16rpx solid #f2f2f2;
    }
 
    .d-f {
        display: flex;
    }
 
    .zt {
        padding: 2rpx 10rpx;
        margin-right: 10rpx;
        border-radius: 8rpx;
        font-size: 22rpx;
    }
 
    .icon-box .icon-zhifubao {
        color: #1296db;
        font-size: 50rpx;
    }
 
    .icon-dianpu1 {}
 
    .text_area {
        width: 100%;
        height: 120rpx;
        background: #f2f2f2;
        border-radius: 6rpx;
        padding: 20rpx;
        box-sizing: border-box;
        font-size: 24rpx;
    }
    .icon-xuanze{
        font-size: 38rpx;
    }
    .buy-checkout .item {
        padding: 30rpx 0;
        margin: 0 30rpx;
    }
</style>