浏览代码

规整代码

DESKTOP-SYIYI\Dell 7 年之前
父节点
当前提交
5f25e5d214

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+node_modules/
+.idea/

+ 39 - 42
src/components/blocks/block_list.vue

@@ -10,20 +10,20 @@
                     let dataMap = this.history.dataMap;
                     //cache old data
                     dataMap.set(oldVal, {
-                        proxy: this.proxy,
-                        list: this.special_list,
+                        data: this.proxy.data,
                         y: document.body.scrollTop
                     });
                     //restore data
                     if (dataMap.has(val)) {
-                        let data = dataMap.get(val)
-                        this.proxy = data.proxy
-                        this.special_list = data.list
-                        let pos = data.y;
+                        let oldData = dataMap.get(val)
+                        this.proxy.clearData();
+                        this.proxy.addData(oldData.data);
+                        let pos = oldData.y;
                         setTimeout(() => {
                             document.body.scrollTop = pos;
                         }, 100);
                     } else {
+                        this.proxy.clearData();
                         this.getDatas();
                     }
                 }
@@ -39,40 +39,38 @@
                 let _self = this;
                 this.$http.jsonp(this.datasLink).then(function (res) {
                     let body = JSON.parse(res.bodyText);
-                    _self.datas = body.datas;
                     _self.hasmore = body.datas['mobile_page'].hasmore;
-                    if(body.datas['mobile_page'].hasmore) {
-                        this.scrollBottomEvent(this.datasLink,this.loadMore);
+                    if (body.datas['mobile_page'].hasmore) {
+                        this.scrollBottomEvent(this.datasLink, this.loadMore);
                     }
-                    _self.special_list = body.datas['special_list'];
-                    _self.proxy = new Proxy(body.datas);
+                    _self.proxy.addData(res.bodyText);
                     _self.proxy.setTag("SPECIAL_ID", this.special_id);
                     _self.proxy.setTag("HOT_ID", this.hot_id);
                     _self.proxy.setTag("BRAND_ID", this.brand_id);
                     _self.proxy.setTag("WORDS", this.keyword);
                     this.$store.commit('updateLoadingStatus', {isLoading: false});
-                },res => {
+                }, res => {
                     this.$vux.toast.show({
-                        type:'text',
+                        type: 'text',
                         text: "网络错误",
-                        position:'middle'
+                        position: 'middle'
                     });
                     this.$store.commit('updateLoadingStatus', {isLoading: false});
                 })
             },
-            scrollBottomEvent(link,callback){
+            scrollBottomEvent(link, callback){
                 //滑动到底部
-                window.addEventListener('scroll',function(){
+                window.addEventListener('scroll', function () {
                     this.scrollTop = document.body.scrollTop;
                     this.documentHeight = document.body.scrollHeight;
-                    this.windowHeight = window.screen.height*2;
-                    if(this.scrollTop + this.windowHeight >= this.documentHeight){
+                    this.windowHeight = window.screen.height * 2;
+                    if (this.scrollTop + this.windowHeight >= this.documentHeight) {
                         callback(link);
                     }
                 });
             },
             loadMore(link){
-                this.$http.jsonp(link+'&curpage=3').then(function(res){
+                this.$http.jsonp(link + '&curpage=3').then(function (res) {
                     console.log(res);
                 })
             }
@@ -80,17 +78,15 @@
         data()
         {
             return {
-                datas:{},
-                special_list: [],
-                proxy: {},
+                proxy: new Proxy(),
                 history: {
                     dataMap: new Map(),
                 },
-                hasmore:false,
-                page_total:0,
-                scrollTop:0,
-                documentHeight:0,
-                windowHeight:0
+                hasmore: false,
+                page_total: 0,
+                scrollTop: 0,
+                documentHeight: 0,
+                windowHeight: 0
             }
         }
         ,
@@ -99,17 +95,17 @@
             let _self = this;
             let specialArray = [];
 
-            if (_self.special_list == null || !_self.special_list) {
+            if (_self.proxy.specialList.length <= 0) {
                 let loadMore = createElement(LoadMore, {
                     props: {
                         showLoading: false,
                         tip: "暂无数据",
-                        backgroundColor:"#f9f9f9"
+                        backgroundColor: "#f9f9f9"
                     }
                 }, []);
                 return createElement('div', {
-                    style:{
-                        backgroundColor:"#f9f9f9"
+                    style: {
+                        backgroundColor: "#f9f9f9"
                     }
                 }, [loadMore]);
             }
@@ -117,29 +113,29 @@
                 let loadMore = createElement(LoadMore, {
                     props: {
                         tip: "正在为您全力加载",
-                        backgroundColor:"red"
+                        backgroundColor: "red"
                     },
-                    style:{
-                        margin:'0 auto'
+                    style: {
+                        margin: '0 auto'
                     }
                 });
-                let loadMoreBox = createElement('div',{
-                    style:{
-                        backgroundColor:"#f9f9f9"
+                let loadMoreBox = createElement('div', {
+                    style: {
+                        backgroundColor: "#f9f9f9"
                     }
-                },[loadMore]);
-                _self.special_list.map(function (special) {
+                }, [loadMore]);
+                _self.proxy.specialList.map(function (special) {
                     let comp = BlockUtil.createBlockComp(createElement, special, _self.proxy);
                     if (comp) {
                         specialArray.push(comp);
                     }
                 });
-                if(this.hasmore) {
+                if (this.hasmore) {
                     specialArray.push(loadMoreBox);
                 }
                 return createElement('div', {
-                    style:{
-                        backgroundColor:"#f9f9f9"
+                    style: {
+                        backgroundColor: "#f9f9f9"
                     }
                 }, specialArray);
             }
@@ -154,6 +150,7 @@
         height: auto;
         display: block;
     }
+
     .weui-loading {
         min-width: 40px;
         min-height: 40px;

+ 40 - 20
src/components/blocks/util/proxy.js

@@ -1,14 +1,34 @@
 class Proxy {
 
-    constructor(json) {
-        if (!json) {
-            throw new Error("data is error");
-        }
-        else {
-            this.datas = json;
-            this.cart_list = json.cart_list;
-            this.bundling_list = json.bundling;
-        }
+    constructor() {
+        this.cartList = [];
+        this.bundlingList = [];
+        this.summeryList = [];
+        this.groupBuyList = [];
+        this.fcodeList = [];
+        this.specialList = []
+        this.data = {};
+        this.tags = new Map();
+    }
+
+    addData(text) {
+        let json = JSON.parse(text).datas;
+        this.specialList = this.specialList.concat(json.special_list);
+        this.cartList = this.cartList.concat(json.cart_list);
+        this.bundlingList = this.bundlingList.concat(json.bundling);
+        this.summeryList = this.summeryList.concat(json.summary);
+        this.groupBuyList = this.groupBuyList.concat(json.groupbuy);
+        this.fcodeList = this.fcodeList.concat(json.fcodes);
+        this.data = text;
+    }
+
+    clearData() {
+        this.cartList = [];
+        this.bundlingList = [];
+        this.summeryList = [];
+        this.groupBuyList = [];
+        this.fcodeList = [];
+        this.specialList = []
         this.tags = new Map();
     }
 
@@ -40,22 +60,22 @@ class Proxy {
 
     getCart(cart_id) {
         for (let i = 0; i < this.cart_list.length; i++) {
-            if (this.cart_list[i].cart_id == cart_id)
-                return this.cart_list[i];
+            if (this.cartList[i].cart_id == cart_id)
+                return this.cartList[i];
         }
     }
 
     getBundling(bl_id) {
-        for (let i = 0; i < this.bundling_list.length; i++) {
-            if (this.bundling_list[i].bl_id == bl_id) {
-                return this.bundling_list[i];
+        for (let i = 0; i < this.bundlingList.length; i++) {
+            if (this.bundlingList[i].bl_id == bl_id) {
+                return this.bundlingList[i];
             }
         }
     }
 
     getSummery(goods_id) {
-        for (let i = 0; i < this.datas.summary.length; i++) {
-            let summery = this.datas.summary[i];
+        for (let i = 0; i < this.summeryList.length; i++) {
+            let summery = this.summeryList[i];
             if (summery['goods_id'] == goods_id) {
                 return summery;
             }
@@ -63,8 +83,8 @@ class Proxy {
     }
 
     getGroupbuy(groupbuy_id) {
-        for (let i = 0; i < this.datas.groupbuy.length; i++) {
-            let groupbuy = this.datas.groupbuy[i];
+        for (let i = 0; i < this.groupBuyList.length; i++) {
+            let groupbuy = this.groupBuyList[i];
             if (groupbuy['groupbuy_id'] == groupbuy_id) {
                 return groupbuy;
             }
@@ -72,8 +92,8 @@ class Proxy {
     }
 
     getFcode(fcode_id) {
-        for (let i = 0; i < this.datas.fcodes.length; i++) {
-            let fode = this.datas.fcodes[i];
+        for (let i = 0; i < this.fcodeList.length; i++) {
+            let fode = this.fcodeList[i];
             if (fode['fcode_id'] == fcode_id) {
                 return fode;
             }

+ 95 - 53
src/components/confirm_order/confirm_order.vue

@@ -11,7 +11,10 @@
                     </flexbox-item>
                 </flexbox>
                 <div v-else>
-                    <p style="text-align: center;color:#EB4E4F; padding: 50px 0;background: #fff; font-size: 26px;"><icon type="warn"></icon>请填写收货人信息</p>
+                    <p style="text-align: center;color:#EB4E4F; padding: 50px 0;background: #fff; font-size: 26px;">
+                        <icon type="warn"></icon>
+                        请填写收货人信息
+                    </p>
                 </div>
             </div>
             <group>
@@ -32,7 +35,8 @@
                         <flexbox-item :span="3/6" style="padding-left: 25px;">
                             <p>{{goods.goods_mobile_name}}</p>
                             <p style="margin: 20px 0 40px 0;" class="letter_pro">{{goods.goods_spec}}</p>
-                            <p><span class="letter_warn" style="margin-right: 10px; font-size: 30px;">¥{{goods.act_type == 0?goods.bonus_price:goods.goods_promotion_price}}</span><span class="letter_pro">专柜价{{goods.goods_price}}</span></p>
+                            <p><span class="letter_warn" style="margin-right: 10px; font-size: 30px;">¥{{goods.act_type == 0?goods.bonus_price:goods.goods_promotion_price}}</span><span
+                                    class="letter_pro">专柜价{{goods.goods_price}}</span></p>
                         </flexbox-item>
                         <flexbox-item style="text-align: right;">
                             <span class="letter_pro">x{{goods.goods_num}}</span>
@@ -40,29 +44,36 @@
                     </flexbox>
                 </flexbox-item>
             </flexbox>
-            <div style="background: #fff; padding:20px 0 20px 30px;" v-if="datas.payinfo.gap_desc"><span class="letter_pro">{{datas.payinfo.gap_desc}}</span></div>
+            <div style="background: #fff; padding:20px 0 20px 30px;" v-if="datas.payinfo.gap_desc"><span
+                    class="letter_pro">{{datas.payinfo.gap_desc}}</span></div>
             <div class="entry">
                 <flexbox>
                     <flexbox-item>
                         <flexbox>
                             <flexbox-item :span="4/5" style="line-height: 50px;">商品总价</flexbox-item>
-                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_warn">¥ {{datas.payinfo['goods_amount']}}</span></flexbox-item>
+                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_warn">¥ {{datas.payinfo['goods_amount']}}</span>
+                            </flexbox-item>
                         </flexbox>
                     </flexbox-item>
                 </flexbox>
                 <flexbox>
                     <flexbox-item>
                         <flexbox>
-                            <flexbox-item :span="4/5" style="line-height: 50px;">{{datas.payinfo['full_desc']}}</flexbox-item>
-                            <flexbox-item :span="1/5" style="text-align: right" v-if="datas.payinfo['full_desc']"><span class="letter_info">- ¥ {{datas.payinfo['full_discount']}}</span></flexbox-item>
+                            <flexbox-item :span="4/5" style="line-height: 50px;">{{datas.payinfo['full_desc']}}
+                            </flexbox-item>
+                            <flexbox-item :span="1/5" style="text-align: right" v-if="datas.payinfo['full_desc']"><span
+                                    class="letter_info">- ¥ {{datas.payinfo['full_discount']}}</span></flexbox-item>
                         </flexbox>
                     </flexbox-item>
                 </flexbox>
                 <flexbox>
                     <flexbox-item>
                         <flexbox v-for="bonus in datas.payinfo['bonus_rates']" :key="bonus">
-                            <flexbox-item :span="4/5" style="line-height: 50px;"><span class="bonus_bg"><span class="bonus_rate">{{bonus.rate}}%</span></span>红包抵扣</flexbox-item>
-                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_info">- ¥ {{bonus.total}}</span></flexbox-item>
+                            <flexbox-item :span="4/5" style="line-height: 50px;"><span class="bonus_bg"><span
+                                    class="bonus_rate">{{bonus.rate}}%</span></span>红包抵扣
+                            </flexbox-item>
+                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_info">- ¥ {{bonus.total}}</span>
+                            </flexbox-item>
                         </flexbox>
                     </flexbox-item>
                 </flexbox>
@@ -70,25 +81,31 @@
                     <flexbox-item>
                         <flexbox>
                             <flexbox-item :span="4/5" style="line-height: 50px;">运费</flexbox-item>
-                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_warn">+ ¥ {{datas.payinfo['freight']}}</span></flexbox-item>
+                            <flexbox-item :span="1/5" style="text-align: right"><span class="letter_warn">+ ¥ {{datas.payinfo['freight']}}</span>
+                            </flexbox-item>
                         </flexbox>
                     </flexbox-item>
                 </flexbox>
             </div>
         </div>
         <div class="order_pay">
-            <div class="default_address" v-if="datas.address !== null">配送至:{{store_address?store_address.address:datas.address.area_info+datas.address.address}}</div>
+            <div class="default_address" v-if="datas.address !== null">
+                配送至:{{store_address?store_address.address:datas.address.area_info+datas.address.address}}
+            </div>
             <div class="just_buy">
                 <flexbox>
-                    <flexbox-item :span="4/6" style="text-align: center;line-height: 93px; font-size: 30px;">应付: <span class="letter_warn">¥ {{datas.payinfo['pay_cash_pred']}}</span></flexbox-item>
-                    <flexbox-item :span="2/6"  style="text-align: center;background:#EB4E4F;color: #fff;line-height: 93px; "><p @click="onBridgeReady">去付款</p></flexbox-item>
+                    <flexbox-item :span="4/6" style="text-align: center;line-height: 93px; font-size: 30px;">应付: <span
+                            class="letter_warn">¥ {{datas.payinfo['pay_cash_pred']}}</span></flexbox-item>
+                    <flexbox-item :span="2/6"
+                                  style="text-align: center;background:#EB4E4F;color: #fff;line-height: 93px; "><p
+                            @click="onBridgeReady">去付款</p></flexbox-item>
                 </flexbox>
             </div>
         </div>
     </div>
 </template>
 <script>
-    import { Flexbox,FlexboxItem,Group,CellBox,XSwitch,XInput,Icon} from 'vux'
+    import {Flexbox, FlexboxItem, Group, CellBox, XSwitch, XInput, Icon} from 'vux'
     import Api from '../../lib/api'
     import Proxy from '../blocks/util/proxy'
 
@@ -100,20 +117,20 @@
             let goods_id = this.$route.query["goods_id"];
             let goods_num = this.$route.query['num'];
             let iscart = this.$route.query["iscart"];
-            let cart_id = this.$route.query["cart_id"]?this.$route.query["cart_id"]:'';
-            this.$http.jsonp(Api.step_first(iscart,cart_id,goods_id,goods_num)).then(function(res){
-                if(res.body.datas == null && res.body.code !== '200') {
+            let cart_id = this.$route.query["cart_id"] ? this.$route.query["cart_id"] : '';
+            this.$http.jsonp(Api.step_first(iscart, cart_id, goods_id, goods_num)).then(function (res) {
+                if (res.body.datas == null && res.body.code !== '200') {
                     this.$vux.toast.show({
-                        type:'warn',
+                        type: 'warn',
                         text: res.body.message,
-                        position:'middle',
-                        width:'600px'
+                        position: 'middle',
+                        width: '600px'
                     });
                     this.$router.go(-1);
                 }
                 else {
                     this.datas = res.body['datas'];
-                    this.proxy = new Proxy(res.body['datas']);
+                    this.proxy.addData(res.bodyText);
                     this.$store.commit('updateLoadingStatus', {isLoading: false});
                 }
             })
@@ -123,27 +140,26 @@
                 'name': '',
                 'mobile': '',
                 'address': '',
-                'aid' : ''
+                'aid': ''
             });
         },
         data ()
         {
             return {
-                datas : '',
-                proxy:{},
-                aid:''
+                datas: '',
+                proxy: new Proxy(),
+                aid: ''
             }
         },
-        computed:
-        {
+        computed: {
             default_address(){
                 let address_list = this.datas['address'];
             },
             goods_list(){
-                if(!this.datas)return;
+                if (!this.datas)return;
                 let goods_list = this.datas.goods_list;
                 let list = [];
-                for(let i =0;i<goods_list.length;i++) {
+                for (let i = 0; i < goods_list.length; i++) {
                     let goods_item = this.proxy.getSummery(goods_list[i].goods_id);
                     goods_item.goods_num = goods_list[i].goods_num;
                     list.push(goods_item);
@@ -152,7 +168,7 @@
             },
             store_address(){
                 let address;
-                if(this.$store.state.address['name']) {
+                if (this.$store.state.address['name']) {
                     address = this.$store.state.address;
                     return address;
                 }
@@ -161,43 +177,55 @@
                 }
             }
         },
-        methods:
-        {
+        methods: {
             link_address(){
-                this.$router.push({path:'/address/list',query:{need_goBack:true}});
+                this.$router.push({path: '/address/list', query: {need_goBack: true}});
             },
             onBridgeReady(){
                 let goods_id = this.$route.query["goods_id"];
                 let goods_num = this.$route.query['num'];
                 let iscart = this.$route.query["iscart"];
-                let cart_id = this.$route.query["cart_id"]?this.$route.query["cart_id"]:'';
+                let cart_id = this.$route.query["cart_id"] ? this.$route.query["cart_id"] : '';
                 let vat_hash = this.datas['payinfo'].vat_hash;
                 let offpay_hash = this.datas['payinfo'].offpay_hash;
                 let offpay_hash_batch = this.datas['payinfo'].offpay_hash_batch;
-                let address_id = this.store_address?this.store_address.aid:this.datas['address'].address_id;
+                let address_id = this.store_address ? this.store_address.aid : this.datas['address'].address_id;
                 console.log(address_id);
-                this.$http.jsonp(Api.step_second(cart_id,goods_id,goods_num,address_id,0,vat_hash,offpay_hash,offpay_hash_batch)).then(function(res){
-                    let param = res.body.datas.param.data;
-                    WeixinJSBridge.invoke(
-                        'getBrandWCPayRequest', {
-                            "appId": param.appId,     //公众号名称,由商户传入
-                            "timeStamp": param.timeStamp,         //时间戳,自1970年以来的秒数
-                            "nonceStr": param.nonceStr, //随机串
-                            "package": param.package,
-                            "signType": param.signType,         //微信签名方式:
-                            "paySign": param.paySign //微信签名
-                        },
-                        function (res) {
-                            if (res.err_msg == "get_brand_wcpay_request:ok") {
-                                alert('支付成功');
-                            }     // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回    ok,但并不保证它绝对可靠。
+                this.$http.jsonp(Api.step_second(cart_id, goods_id, goods_num, address_id, 0, vat_hash, offpay_hash, offpay_hash_batch)).then(function (res) {
+                    if (res.status == 200 && res.body.code == 200) {
+                        let param = res.body.datas.param.data;
+                        WeixinJSBridge.invoke(
+                            'getBrandWCPayRequest', {
+                                "appId": param.appId,     //公众号名称,由商户传入
+                                "timeStamp": param.timeStamp,         //时间戳,自1970年以来的秒数
+                                "nonceStr": param.nonceStr, //随机串
+                                "package": param.package,
+                                "signType": param.signType,         //微信签名方式:
+                                "paySign": param.paySign //微信签名
+                            },
+                            function (res) {
+                                if (res.err_msg == "get_brand_wcpay_request:ok") {
+                                    alert('支付成功');
+                                }     // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回    ok,但并不保证它绝对可靠。
+                            }
+                        );
+                    } else {
+                        let msg;
+                        if (res.status != 200) {
+                            msg = "网络错误!";
+                        } else {
+                            msg = res.body.message;
                         }
-                    );
+                        this.$vux.toast.show({
+                            type: 'text',
+                            text: msg,
+                            position: 'middle'
+                        });
+                    }
                 });
             }
         },
-        components:
-        {
+        components: {
             Flexbox,
             FlexboxItem,
             Group,
@@ -212,12 +240,15 @@
     #router_view {
         background: #f9f9f9;
     }
+
     .address_box {
-        padding:24px 0 24px 40px;
+        padding: 24px 0 24px 40px;
     }
+
     .address_box p {
         line-height: 50px;
     }
+
     .address_icon {
         display: inline-block;
         width: 34px;
@@ -225,24 +256,29 @@
         background: url("../../assets/address_icon.jpg") no-repeat;
         background-size: 100% 100%;
     }
+
     .check_order {
         padding-bottom: 133px;
     }
+
     .entry {
         background: #fff;
         margin-top: 0.71428571em;
         padding: 30px;
     }
+
     .order_pay {
         position: fixed;
         bottom: 0;
         left: 0;
         width: 100%;
     }
+
     .just_buy {
         height: 93px;
         background: #fff;
     }
+
     .default_address {
         font-size: 18px;
         background: #ffeab8;
@@ -251,23 +287,29 @@
         line-height: 40px;
         padding-left: 30px;
     }
+
     .bonus_bg {
         background: #f2bb11;
         padding: 5px;
         margin-right: 5px;
     }
+
     .bonus_rate {
         border: 1px dashed #fff;
     }
+
     .letter_pro {
         color: #a7a7a7;
     }
+
     .letter_info {
         color: #09BB07;
     }
+
     .letter_warn {
         color: #EB4E4F;
     }
+
     .weui-icon-warn {
         vertical-align: text-bottom;
         font-size: 34px;

+ 7 - 4
src/components/main/shop-car/CarProxy.js

@@ -4,11 +4,14 @@
 import Proxy from '../../blocks/util/proxy.js'
 
 class CarProxy extends Proxy {
-    constructor(json) {
-        //调用实现父类的构造函数
-        super(json);
-        this.infos = json.free_info
+    constructor() {
+        super();
+    }
 
+    addData(text) {
+        super.addData(text);
+        let json = JSON.parse(text).datas;
+        this.infos = json.free_info;
     }
 
     getGoodsPrice(goods_id, need_bonus) {

+ 18 - 18
src/components/main/shop-car/shopping_cart.vue

@@ -87,14 +87,14 @@
         created(){
             this.$store.commit('updateLoadingStatus', {isLoading: true});
             this.$http.jsonp(Api.shoppingCart()).then(function (res) {
-                this.proxy = new CarProxy(res.body.datas);
+                this.proxy.addData(res.bodyText);
                 this.cart_l_items = this.cart_items();
                 this.$store.commit('updateLoadingStatus', {isLoading: false});
             })
         },
         data(){
             return {
-                proxy: {},
+                proxy: new CarProxy(),
                 cart_l_items: [],
                 all_select: 'circle'
             }
@@ -123,7 +123,7 @@
                 return ret;
             },
             cart_items(){
-                let cart_lists = this.proxy.cart_list;
+                let cart_lists = this.proxy.cartList;
                 let cart_items = [];
                 for (let i = 0; i < cart_lists.length; i++) {
                     let cart = {};
@@ -167,7 +167,7 @@
                         let cart_id = cart_item.cart_id;
                         for (let i = 0; i < this.cart_l_items.length; i++) {
                             if (cart_id == this.cart_l_items[i].cart_id) {
-                                _self.proxy.cart_list.splice(i, 1);
+                                _self.proxy.cartList.splice(i, 1);
                                 this.cart_l_items.splice(i, 1);
                                 break;
                             }
@@ -207,21 +207,21 @@
                 }
             },
             just_buy(){
-               let carts = this.getSelectedCar().map(function(item){
-                   return  item.cart_id;
+                let carts = this.getSelectedCar().map(function (item) {
+                    return item.cart_id;
                 });
-               let carts_items = carts.join(",");
-               if(!carts_items) {
-                   this.$vux.toast.show({
-                       type:'warn',
-                       text: '请至少选择一件商品',
-                       position:'middle',
-                       width:'600px'
-                   });
-               }
-               else {
-                   this.$router.push({path:'/confirm_order',query:{iscart:1,cart_id:carts_items}});
-               }
+                let carts_items = carts.join(",");
+                if (!carts_items) {
+                    this.$vux.toast.show({
+                        type: 'warn',
+                        text: '请至少选择一件商品',
+                        position: 'middle',
+                        width: '600px'
+                    });
+                }
+                else {
+                    this.$router.push({path: '/confirm_order', query: {iscart: 1, cart_id: carts_items}});
+                }
             }
         },
         components: {

+ 2 - 2
src/lib/api.js

@@ -99,11 +99,11 @@ class Api {
         return this.host() + `/mobile/index.php?act=member_buy&op=step_first&curpage=1&ifcart=${ifcart}&cart_id=${goods_datas}&client_type=ajax`;
     }
 
-    static step_second(cart_ids, goods_id, goods_num, addr_id, inv_id, vat_hash, offpay_hash, offpay_hash_batch){
+    static step_second(cart_ids, goods_id, goods_num, addr_id, inv_id, vat_hash, offpay_hash, offpay_hash_batch) {
         let ifcart = cart_ids !== '' ? true : false;
         let iscart = ifcart ? 1 : 0;
         let cartids = ifcart ? cart_ids : (goods_id + '|' + goods_num);
-        return this.host()+`/mobile/index.php?client_type=ajax&act=member_buy&op=step_second&payment=jspay&usebonus=1&ifcart=${iscart}&cart_id=${cartids}&address_id=${addr_id}&invoice_id=${inv_id}&vat_hash=${vat_hash}&offpay_hash=${offpay_hash}&offpay_hash_batch=${offpay_hash_batch}`;
+        return this.host() + `/mobile/index.php?client_type=ajax&act=member_buy&op=step_second&payment=jspay&usebonus=1&ifcart=${iscart}&cart_id=${cartids}&address_id=${addr_id}&invoice_id=${inv_id}&vat_hash=${vat_hash}&offpay_hash=${offpay_hash}&offpay_hash_batch=${offpay_hash_batch}`;
     }
 
     static get_address() {