瀏覽代碼

支付成功

zhashaonan 6 年之前
父節點
當前提交
b5c033719d

+ 7 - 0
app.wxss

@@ -114,6 +114,9 @@ page {
 .mt20 {
   margin-top: 20rpx;
 }
+.mb10 {
+  margin-bottom: 10rpx;
+}
 .mb20 {
   margin-bottom: 20rpx;
 }
@@ -227,4 +230,8 @@ page {
   right: 50rpx;
   bottom: 50rpx;
   width: 106rpx;
+}
+.align_center {
+  display: flex;
+  align-items: center;
 }

+ 1 - 1
config.js

@@ -2,7 +2,7 @@
 // let api = "https://passport.lrlz.com/mobile/index.php";
 let api = "http://a.lrlz.com/mobile/index.php";
 // let api = "http://121.43.114.153/mobile/index.php"
-// let api = "http://192.168.0.200/mobile/index.php";
+// let api = "http://192.168.0.131/mobile/index.php";
 
 
 function getReq(data, callback, fail) {

+ 4 - 4
pages/components/blocks/goods_item/goods_item.wxml

@@ -18,7 +18,7 @@
         <text class="current_price">¥{{goods.bonus_price}}</text>
       </view>
       <view class='deduction'>
-        <view class="original_price">天猫价{{goods.goods_price}}</view>
+        <view class="original_price">专柜价{{goods.goods_price}}</view>
         <text class="discount">{{goods.bonus_price == 0 ? "红包全额抵扣" : "红包抵"+goods.discounts+"元"}}</text>
       </view>
     </view>
@@ -27,16 +27,16 @@
         <text class="current_price">¥{{goods.bonus_price}}</text>
       </view>
       <view>
-        <text class="original_price">天猫价{{goods.goods_price}}</text>
+        <text class="original_price">专柜价{{goods.goods_price}}</text>
         <text class="discount">红包抵{{goods.goods_price - goods.bonus_price}}元</text>
       </view>
     </view>
     <view class="goods_price" wx:if="{{goods.act_type == 2}}">
       <view>
-        <text class="current_price">¥{{goods.bonus_price}}</text>
+        <text class="current_price">¥{{goods['goods_promotion_price']}}</text>
       </view>
       <view>
-        <text class="original_price">天猫价{{goods.goods_price}}</text>
+        <text class="original_price">专柜价{{goods.goods_price}}</text>
         <text class="discount">红包抵{{goods.goods_price - goods.bonus_price}}元</text>
       </view>
     </view>  

+ 1 - 1
pages/components/blocks/goods_item/goods_item.wxss

@@ -39,7 +39,7 @@
 
 .goods_item .current_price {
   font-size: 28rpx;
-  color: #ff4e4e;
+  color: #333;
 }
 
 .goods_item .original_price, .goods_item .discount {

+ 1 - 1
pages/components/blocks/search_box/search_box.wxss

@@ -22,7 +22,7 @@
 }
 .search_input {
   display: inline-block;
-  width: 610rpx;
+  width: 600rpx;
   height: 55rpx;
   line-height: 55rpx;
   background: #f9f9f9;

+ 23 - 0
pages/components/template/loadAnimation/loadAnimation.js

@@ -0,0 +1,23 @@
+// components/template/loadAnimation/loadAnimation.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 4 - 0
pages/components/template/loadAnimation/loadAnimation.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 15 - 0
pages/components/template/loadAnimation/loadAnimation.wxml

@@ -0,0 +1,15 @@
+<!--components/template/loadAnimation/loadAnimation.wxml-->
+
+<template name="detailLoad">
+  <view class="load-container">
+    <view class="big-img bacf7f8fa"></view>
+    <view class="content-wrap">
+      <view class="full-line bacf7f8fa"></view>
+      <view class="normal-line t36 bacf7f8fa"></view>
+      <view class="short-line t36 bacf7f8fa"></view>
+      <view class="short-line t36 bacf7f8fa"></view>
+      <view class="normal-line t60 bacf7f8fa"></view>
+      <view class="large-line  t50 bacf7f8fa"></view>
+    </view>
+  </view>
+</template>

+ 43 - 0
pages/components/template/loadAnimation/loadAnimation.wxss

@@ -0,0 +1,43 @@
+/* components/template/loadAnimation/loadAnimation.wxss */
+.t36 {
+  margin-top: 36rpx;
+}
+.t50 {
+  margin-top: 50rpx;
+}
+.t60 {
+  margin-top: 60rpx;
+}
+.bacf7f8fa {
+  background: #f7f8fa;
+}
+.load-container {
+  position: fixed;
+  left: 0;
+  right: 0;
+  top: 0;
+  bottom: 0;
+  z-index: 9999;
+  background: #fff;
+  
+}
+.big-img {
+  height: 500rpx;
+}
+.content-wrap {
+  padding: 0 30rpx;
+  margin-top: 50rpx;
+}
+.full-line {
+  height: 70rpx;
+}
+.normal-line {
+  height: 70rpx;
+  margin-right: 130rpx;
+}
+.short-line {
+  height: 30rpx;
+}
+.large-line {
+  height: 120rpx;
+}

+ 118 - 35
pages/confirmOrder/confirmOrder.js

@@ -1,5 +1,6 @@
 // pages/confirmOrder/confirmOrder.js
 const getReq = require('./../../config.js').getReq
+import Bundle from '../../utils/Bundle'
 let appInstance = getApp()
 Page({
 
@@ -14,7 +15,8 @@ Page({
     goods_list: [],
     firstLoad: true,
     defaultAddress: null,
-    cart_id: ''
+    cart_id: '',
+    n_goods_list: [],
   },
 
   /**
@@ -31,9 +33,15 @@ Page({
       num,
       cart_id
     })
-    // console.log(goods_id, iscart, num, cart_id);
     this.getDatas(goods_id, iscart, num, cart_id)
-    // this.getDatas(4807, 0, 1, '')
+
+    // 测试套装数据
+    //  this.getDatas(goods_id, 1, num, '16403,16406')
+    //  act:member_buy
+    // cart_id:16403,16406
+    // op:step_first
+    // from:YWN0PWNhcnQmb3A9ZXhnb29kcyZjdXJwYWdlPTE%3D
+    // ifcart:1
   },
   getDatas(goods_id, ifcart, num, cart_id) {
     wx.showLoading({
@@ -47,19 +55,37 @@ Page({
     else {
       goods_datas = cart_id;
     }
-    getReq({
+    // let bundleParams = {
+    //   act: 'member_buy',
+    //   op: 'step_first',
+    //   cart_id: '16407,16408',
+    //   ifcart: 1
+    // }
+
+    // let defaultParams = {
+    //   act: 'member_buy',
+    //   cart_id: '4807|1',
+    //   op: 'step_first',
+    //   ifcart: 0
+    // }
+
+    let params = {
       act: 'member_buy',
       op: 'step_first',
       curpage: 1,
       cart_id: goods_datas,
       ifcart,
-    }, function (res) {
+    }
+
+
+    getReq(params, function (res) {
       wx.hideLoading()
       if (res.code == 200) {
-        console.log(res);
         let datas = res.datas
-        let goods_list = self.getGoodsList(datas.summary, datas.goods_list)
-        console.log('goods_list', goods_list);
+        console.log('datas:', datas);
+        let { goods_list, summary, bundling } = res.datas
+        let n_goods_list = self.getNewGoodsList(goods_list, summary, bundling)
+
         if (datas.address) {
           let { true_name, mob_phone, area_info, address, address_id } = datas.address;
           appInstance.checkDefaultAddress({
@@ -72,7 +98,7 @@ Page({
         }
         self.setData({
           datas,
-          goods_list,
+          n_goods_list,
           firstLoad: false,
           defaultAddress: datas.address
         })
@@ -84,26 +110,26 @@ Page({
           duration: 2000
         })
         appInstance.globalData.fcodeErr = res.message
-        wx.navigateBack()      
+        wx.navigateBack()
       }
     })
   },
-  getGoodsList(summary, goods_list) {
-    console.log('summary', summary);
-    console.log('goods_list', goods_list);
-    let newGoodsList = []
-    goods_list.map((item, index) => {
-      summary.find((list, key) => {
-        if (item.goods_id == list.goods_id) {
-          let goods_item = list
-          goods_item.goods_num = item.goods_num
-          newGoodsList.push(goods_item)
-          return true
-        }
-      })
-    })
-    return newGoodsList
-  },
+  // getGoodsList(summary, goods_list) {
+  //   console.log('summary', summary);
+  //   console.log('goods_list', goods_list);
+  //   let newGoodsList = []
+  //   goods_list.map((item, index) => {
+  //     summary.find((list, key) => {
+  //       if (item.goods_id == list.goods_id) {
+  //         let goods_item = list
+  //         goods_item.goods_num = item.goods_num
+  //         newGoodsList.push(goods_item)
+  //         return true
+  //       }
+  //     })
+  //   })
+  //   return newGoodsList
+  // },
   toPay() {
     if (!this.data.defaultAddress) {
       wx.showToast({
@@ -117,7 +143,7 @@ Page({
     let goods_num = this.data.num
     let iscart = this.data.ifcart
     let cart_id = this.data.cart_id
-    
+
     let vat_hash = this.data.datas['payinfo'].vat_hash
     let offpay_hash = this.data.datas['payinfo'].offpay_hash
     let offpay_hash_batch = this.data.datas['payinfo'].offpay_hash_batch
@@ -128,7 +154,8 @@ Page({
     getReq({
       act: 'member_buy',
       op: 'step_second',
-      payment: 'jspay',
+      // payment: 'jspay',
+      payment: 'minipay',
       usebonus: 1,
       ifcart,
       cart_id: cartids,
@@ -147,16 +174,19 @@ Page({
           package: param.package,
           signType: param.signType,         //微信签名方式:
           paySign: param.paySign, //微信签名
-          success:function(res){
-            wx.showToast({
-              icon: 'none',
-              title: res,
-              duration: 2000
+          success: function (res) {
+            // wx.showToast({
+            //   icon: 'none',
+            //   title: res,
+            //   duration: 2000
+            // })
+            wx.reLaunch({
+              url: "/pages/index/index"
             })
-            console.log("成功:"+res);
+            console.log("成功:" + res);
             console.log('支付成功')
           },
-          fail:function(res){
+          fail: function (res) {
             wx.showToast({
               icon: 'none',
               title: res,
@@ -177,6 +207,59 @@ Page({
       }
     })
   },
+
+  getNewGoodsList(goods_list, summary, bundling) {
+    let summaryMap = new Map()
+    let bundlingMap = new Map()
+    summary.map(item => {
+      summaryMap.set(item['goods_id'], item)
+    })
+    if (bundling.length) {
+      bundling.map(item => {
+        bundlingMap.set(item['bl_id'], item)
+      })
+    }
+    let n_goods_list = new Bundle(goods_list, summaryMap, bundlingMap).createOrders()
+    return n_goods_list
+  },
+
+  // testBundle() {
+  //   let bundleParams = {
+  //     act: 'member_buy',
+  //     op: 'step_first',
+  //     cart_id: '16407,16408',
+  //     ifcart: 1
+  //   }
+
+  //   let defaultParams = {
+  //     act: 'member_buy',
+  //     cart_id: '4807|1',
+  //     op: 'step_first',
+  //     ifcart: 0
+  //   }
+  //   let self = this
+  //   getReq(bundleParams, function (res) {
+  //     console.log('Bundle', res);
+  //     if (res.code == 200) {
+  //       let { goods_list, summary, bundling } = res.datas
+  //       let summaryMap = new Map()
+  //       let bundlingMap = new Map()
+  //       summary.map(item => {
+  //         summaryMap.set(item['goods_id'], item)
+  //       })
+  //       if (bundling.length) {
+  //         bundling.map(item => {
+  //           bundlingMap.set(item['bl_id'], item)
+  //         })
+  //       }
+  //       let n_goods_list = new Bundle(goods_list, summaryMap, bundlingMap).createOrders()
+  //       console.log('n_goods_list: ', n_goods_list);
+  //       self.setData({
+  //         n_goods_list
+  //       })
+  //     }
+  //   })
+  // },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 46 - 5
pages/confirmOrder/confirmOrder.wxml

@@ -13,7 +13,7 @@
       <image class="see_ensure_desc" src="../../image/back.png"></image>
     </view>
     <view wx:else class="address_none">
-      <icon type="warn" size="23"  color="#333"/>
+      <icon type="warn" size="23" color="#333" />
       <text decode="{{true}}">&nbsp;&nbsp;请填写收货人信息</text>
     </view>
   </navigator>
@@ -23,7 +23,7 @@
     <view class="payment_method payment-1px-b">
       <image class="bonus_pay_icon mr20" src="../../image/bonus_pay.png"></image>
       <view class="mr20">红包支付</view>
-      <view class="f24 col666">可抵扣 ¥20.00</view>
+      <view class="f24 col666">可抵扣 ¥{{datas['payinfo']['available_pred']}}</view>
     </view>
     <view class="payment_method">
       <image class="wx_pay_icon mr16" src="../../image/wx_pay.png"></image>
@@ -31,7 +31,7 @@
     </view>
   </view>
 
-  <view class="bacfff" wx:for="{{goods_list}}" wx:for-index="idx" wx:key="idx">
+  <!-- <view class="bacfff" wx:for="{{goods_list}}" wx:for-index="idx" wx:key="idx">
     <view class="order_goods_content vux-1px-b">
       <image class="order_content_img" src="{{item.goods_image_url}}"></image>
       <view class="order_content_middle over_hidden">
@@ -44,7 +44,49 @@
       </view>
       <view class="order_content_nums">x{{item.goods_num}}</view>
     </view>
+  </view> -->
+  <!-- wx:for-item="bundle" -->
+  <!-- wx:key="*this" wx:for-item="bundle" wx:for-index="bundleIndex" -->
+  <view class="bacfff" wx:for="{{n_goods_list}}" wx:for-item="item" wx:for-index="idx" wx:key="idx">
+    <block wx:if="{item['bl_id'] > 0}">
+      <view class="order_goods_content vux-1px-b" wx:for="{{item['goods']}}" wx:for-item="bl_item" wx:for-index="bl_index" wx:key="bl_index">
+        <!-- <view>{{bl_item}}</view> -->
+        <image class="order_content_img" src="{{bl_item['goods_summary']['goods_image_url']}}"></image>
+        <view class="order_content_middle over_hidden">
+          <view class="l_height42 ft_bold one_line_hidden">{{bl_item['goods_summary']['goods_mobile_name']}}</view>
+          <view class="order_letter_pro one_line_hidden">{{bl_item['goods_summary']['goods_spec']}}</view>
+          <view>
+            <text class="f30 col333 ft_bold mr10"><text class="f24 mr6">¥</text>{{bl_item['bl_goods_price']}}</text>
+            <text decode="{{true}}" class="col999 line-through f24">专柜价{{bl_item['goods_summary']['goods_price']}}</text>
+          </view>
+        </view>
+        <view class="order_content_nums">x{{item['goods_num']}}</view>
+      </view>
+    </block>
+    <block wx:if="{{item['bl_id'] == 0}}">
+      <view class="order_goods_content vux-1px-b">
+        <image class="order_content_img" src="{{item['goods_summary']['goods_image_url']}}"></image>
+        <view class="order_content_middle over_hidden">
+          <view class="l_height42 ft_bold one_line_hidden">{{item['goods_summary']['goods_mobile_name']}}</view>
+          <view class="order_letter_pro one_line_hidden">{{item['goods_summary']['goods_spec']}}</view>
+          <view>
+            <text class="f30 col333 ft_bold mr10" wx:if="{{item['goods_summary']['act_type'] == 0}}"><text class="f24 mr6">¥</text>{{item['goods_summary']['bonus_price']}}</text>
+            <text class="f30 col333 ft_bold mr10" wx:if="{{item['goods_summary']['act_type'] == 2}}"><text class="f24 mr6">¥</text>{{item['goods_summary']['goods_promotion_price']}}</text>
+            <text decode="{{true}}" class="col999 line-through f24">专柜价{{item['goods_summary']['goods_price']}}</text>
+          </view>
+        </view>
+        <view class="order_content_nums">x{{item.goods_num}}</view>
+      </view>
+    </block>
   </view>
+
+
+
+
+
+
+
+
   <!-- <view class="packet_price-tips bacfff" wx:if="{{datas.payinfo.gap_desc}}">{{datas.payinfo.gap_desc}}~</view> -->
   <view class="order_entry mt20">
     <view class="expenses_info">
@@ -68,10 +110,9 @@
     <view class="just_buy">
       <view class="just_buy_left">
         <text>应付: </text>
-        <text class="col2B2B2B ft_bold">¥ {{datas.payinfo['pay_cash_pred']}}</text>
+        <text class="col333 ft_bold">¥ {{datas.payinfo['pay_cash_pred']}}</text>
       </view>
       <view class="just_buy_right" bindtap='toPay'>去付款</view>
     </view>
   </view>
-
 </view>

+ 12 - 13
pages/details/details.js

@@ -37,7 +37,9 @@ Page({
     carouselImgs: [],
     currentPrice: '', // 商品当前价格,
     promotionDays: '',
-    bundleIndex: -1
+    bundleIndex: -1,
+    swiperHeight: '',
+    show: false,
   },
 
   /**
@@ -55,13 +57,7 @@ Page({
       })
     }, 1000);
 
-
-    // console.log(options.goods_id);
     this.getDatas(options.goods_id)
-    // this.getDatas(7636)
-    // this.getDatas(2) // 特殊商品
-    // this.getDatas(260) // 特殊商品
-    // this.getDatas(4807) // a.lrlz.com 有多条评论
     var that = this;
     getReq({
       act: 'goods_common',
@@ -88,7 +84,6 @@ Page({
     }, function (res) {
       wx.hideLoading()
       if (res.code == 200) {
-        console.log(res);
         self.createStars(res.datas.common_info.comments_rate)
         if (res.datas.comments) {
           self.createComments(res.datas.comments)
@@ -104,7 +99,6 @@ Page({
 
 
         let oneSummary = self.getOneSummary(res.datas.summary, goods_id)
-        // console.log('oneSummary:', oneSummary);
         let bundleList = ''
         if (oneSummary['have_bundle']) {
           let bundlingMap = new Map()
@@ -113,7 +107,6 @@ Page({
           })
           let goodsSumaryMap = goodsIdMap ? goodsIdMap : self.data.goodsIdMap
           bundleList = self.createBundles(oneSummary['bundles'], bundlingMap, goodsSumaryMap)
-          console.log('bundleList:', bundleList);
         }
         let getgift = self.getgift(res.datas.summary, goods_id)
         let differencePrice = (oneSummary.goods_price - oneSummary.bonus_price).toFixed(2)
@@ -330,7 +323,6 @@ Page({
     return arr
   },
   getPromotionDays(actId, limitime) {
-    // console.log(this.data.datas);
     let limit = limitime.filter(item => {
       return item['xianshi_id'] == actId
     })
@@ -410,7 +402,6 @@ Page({
     })
   },
   addBundleCart(e) {
-    console.log(e);
     let bl_id =  e.currentTarget.dataset.blid
     getReq({
       act: 'cart',
@@ -418,7 +409,6 @@ Page({
       quantity: 1,
       bl_id
     }, function (res) {
-      console.log(res);
       wx.hideLoading()
       if (res.code == 200) {
         wx.showToast({
@@ -436,6 +426,15 @@ Page({
       }
     })
   },
+  swiperImgLoad(e) {
+    wx.hideLoading()
+    if (this.data.swiperHeight) return;
+    let swiperHeight = e.detail.height / e.detail.width * 750
+    this.setData({
+      swiperHeight,
+      show: true
+    })
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 7 - 3
pages/details/details.wxml

@@ -1,7 +1,12 @@
 <!--pages/details/details.wxml-->
 <import src="../../wxParse/wxParse.wxml" />
-<view class="bacfff">
-  <view class="pos_rel">
+<import src="../components/template/loadAnimation/loadAnimation.wxml" />
+<template is="detailLoad" wx:if="{{!show}}" />
+<view>
+    <image wx:for="{{imgUrls}}" wx:for-index="idx" wx:key="idx" class="imageHeight" src="{{item}}" bindload="swiperImgLoad"></image>
+  </view>
+<view class="bacfff" wx:if="{{show}}">
+  <view class="pos_rel" >
     <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" indicator-color="#E8E8E8"
       circular="true" indicator-active-color="##2B2B2B" style="height:750rpx">
       <block wx:for="{{imgUrls}}" wx:key="*this">
@@ -201,7 +206,6 @@
       </view>
       <view class="flexbox_item">
         <view class="simple_goods_price">
-          <!-- <text decode="{{true}}">¥{{getOneSummary['act_type'] !== 1?getOneSummary.bonus_price:datas['groupbuy'][0]['promotion_price']}}&nbsp;&nbsp;</text> -->
           <text decode="{{true}}" wx:if="{{getOneSummary['act_type'] == 0}}">¥{{getOneSummary.bonus_price}}&nbsp;&nbsp;</text>
           <text decode="{{true}}" wx:if="{{getOneSummary['act_type'] == 2}}">¥{{getOneSummary['goods_promotion_price']}}&nbsp;&nbsp;</text>
           <text class="goods_original_price line-through">专柜价{{getOneSummary.goods_price}}</text>

+ 8 - 0
pages/details/details.wxss

@@ -1,6 +1,7 @@
 /* pages/details/details.wxss */
 @import "../../wxParse/wxParse.wxss";
 @import "../confirmOrder/confirmOrder.wxss";
+@import "../components/template/loadAnimation/loadAnimation.wxss";
 .comment_swiper {
   position: absolute;
   bottom: 90rpx;
@@ -626,6 +627,13 @@
 
 
 /* 新版 */
+.imageHeight {
+  position: absolute;
+  z-index: -1;
+  opacity: 0;
+  width: 1px;
+  height: 1px;
+}
 .align_center {
   display: flex;
   align-items: center;

+ 3 - 1
pages/index/index.js

@@ -22,7 +22,8 @@ Page({
   },
 
   onLoad: function () {
-    this.req_tabs();
+    // this.req_tabs();
+    this.getDatas(0)
   },
 
   req_tabs(){
@@ -33,6 +34,7 @@ Page({
     }, function (res) {
       if (res.code == 200) {
         self.getDatas(res.datas.tabs[0].special_id);
+        // console.log(res.datas.tabs[0].special_id);
         // self.getDatas(1364);
         self.setData({
           tabs: res.datas.tabs

+ 1 - 1
pages/index/index.wxml

@@ -1,7 +1,7 @@
 <!--index.wxml-->
 <view>
   <searchBox></searchBox>
-  <tabs tabs="{{tabs}}" bind:myevent="onMyEvent"></tabs>
+  <!-- <tabs tabs="{{tabs}}" bind:myevent="onMyEvent"></tabs> -->
   <view class='clear_fixed'></view> 
   <blockList prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
   <image bindtap='backTop' style="display:{{isScroll?'block':'none'}}" mode='widthFix' class='back_top_btn' src='../../image/back_top.png'></image> 

+ 2 - 1
pages/index/index.wxss

@@ -20,5 +20,6 @@
   margin-top: 200px;
 }
 .clear_fixed {
-  height: 139rpx;
+  /* height: 139rpx; */
+  height: 100rpx;
 }

+ 52 - 12
pages/orderPaySn/orderPaySn.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    order_info:{},
+    order_info: {},
     defaultAddress: null
   },
 
@@ -29,16 +29,16 @@ Page({
     }, function (res) {
       wx.hideLoading();
       if (res.code == 200) {
-       console.log(res);
-       self.setData({
-         defaultAddress:{
-           mob_phone: res.datas.order.reciver_info.mob_phone,
-           true_name: res.datas.order.reciver_info.reciver_name,
-           area_info: res.datas.order.reciver_info.area,
-           address: res.datas.order.reciver_info.street
-         },
-         order_info: res.datas.order.order_info
-       });
+        console.log(res);
+        self.setData({
+          defaultAddress: {
+            mob_phone: res.datas.order.reciver_info.mob_phone,
+            true_name: res.datas.order.reciver_info.reciver_name,
+            area_info: res.datas.order.reciver_info.area,
+            address: res.datas.order.reciver_info.street
+          },
+          order_info: res.datas.order.order_info
+        });
       }
       else {
         wx.showToast({
@@ -52,7 +52,7 @@ Page({
   getGoodsList(summary, goods_list) {
     let newGoodsList = []
     goods_list.map((item, index) => {
-      summary.filter((list, key) => {
+      summary.find((list, key) => {
         if (item.goods_id == list.goods_id) {
           let goods_item = list
           goods_item.goods_num = item.goods_num
@@ -64,6 +64,46 @@ Page({
     return newGoodsList
 
   },
+  toPay() {
+    let params = {
+      act: 'member_order',
+      op: 'pay',
+      pay_sn: this.data['order_info']['pay_sn'],
+      payment: 'minipay'
+    }
+    getReq(params, function (res) {
+      if (res.code == 200) {
+        let param = res.datas.param.data;
+        wx.requestPayment({
+          timeStamp: param.timeStamp,         //时间戳,自1970年以来的秒数
+          nonceStr: param.nonceStr, //随机串
+          package: param.package,
+          signType: param.signType,         //微信签名方式:
+          paySign: param.paySign, //微信签名
+          success: function (res) {
+            // wx.showToast({
+            //   icon: 'none',
+            //   title: res,
+            //   duration: 2000
+            // })
+            wx.reLaunch({
+              url: "/pages/index/index"
+            })
+            console.log("成功:" + res);
+            console.log('支付成功')
+          },
+          fail: function (res) {
+            wx.showToast({
+              icon: 'none',
+              title: res,
+              duration: 2000
+            })
+            console.log("失败:" + res);
+          }
+        });
+      }
+    })
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 15 - 13
pages/orderPaySn/orderPaySn.wxml

@@ -2,49 +2,51 @@
 <view class="check_order">
   <navigator url="/pages/address/address">
     <view class="address_wrap" wx:if="{{defaultAddress}}">
-      <image class="adress-icon" src="../../image/address-icon.jpeg"></image>
+      <image class="adress-icon" src="../../image/address-icon.png"></image>
       <view>
         <view>
           <text>{{defaultAddress.true_name}}</text>
           <text class="ml8">{{defaultAddress.mob_phone}}</text>
         </view>
-        <view class="mt10">{{defaultAddress.area_info}}{{defaultAddress.address}}</view>
+        <!-- <view class="mt10">{{defaultAddress.area_info}}{{defaultAddress.address}}</view> -->
+        <view class="mt10"><text>{{defaultAddress.area_info}}</text><text class="ml8">{{defaultAddress.address}}</text></view>
       </view>
+      <image class="see_ensure_desc" src="../../image/back.png"></image>
     </view>
     <view wx:else class="address_none">
-      <icon type="warn" size="23" />
+      <icon type="warn" size="23" color="#333" />
       <text decode="{{true}}">&nbsp;&nbsp;请填写收货人信息</text>
     </view>
   </navigator>
 
 
-  <view class="mt20">
+  <view class="mt20 mb20">
     <view class="payment_method payment-1px-b">
+      <image class="bonus_pay_icon mr20" src="../../image/bonus_pay.png"></image>
       <view>红包支付</view>
-      <icon type="success" size="20" color="red" />
     </view>
     <view class="payment_method">
+      <image class="wx_pay_icon mr16" src="../../image/wx_pay.png"></image>
       <view>微信支付</view>
-      <icon type="success" size="20" color="red" />
     </view>
   </view>
 
   <view class="packet_price-tips bacfff" wx:if="{{datas.payinfo.gap_desc}}">{{datas.payinfo.gap_desc}}~</view>
   <view class="order_entry mt20">
     <view class="expenses_info">
-      <view>商品总价</view>
-      <view class="coleb4e4f">¥ {{order_info['goods_amount']}}</view>
+      <view class="col666">商品总价</view>
+      <view class="">¥ {{order_info['goods_amount']}}</view>
     </view>
     <view class="expenses_info" wx:for="{{order_info['bonus_rates']}}" wx:for-index="idx" wx:key="idx">
       <view>
         <text class="bonus_bg"><text class="bonus_rate">{{item.rate}}%</text></text>
         <text>红包抵扣</text>
       </view>
-      <view class="col09BB07">- ¥ {{item.total}}</view>
+      <view class="">- ¥ {{item.total}}</view>
     </view>
     <view class="expenses_info">
-      <view>运费</view>
-      <view class="coleb4e4f">+ ¥ {{order_info['shipping_fee']}}</view>
+      <view class="col666">运费</view>
+      <view class="">+ ¥ {{order_info['shipping_fee']}}</view>
     </view>
   </view>
 
@@ -52,9 +54,9 @@
     <view class="just_buy">
       <view class="just_buy_left">
         <text>应付: </text>
-        <text class="coleb4e4f">¥ {{order_info['pay_cash']}}</text>
+        <text class="col333 ft_bold">¥ {{order_info['pay_cash']}}</text>
       </view>
-      <view class="just_buy_right">去付款</view>
+      <view class="just_buy_right" bindtap="toPay">去付款</view>
     </view>
   </view>
 

+ 1 - 1
pages/order_tabs/orderTabs.wxml

@@ -12,7 +12,7 @@
           <text class='state_desc'>{{item.order_info.state_desc}}</text>
       </view>
       <block wx:key="{{index}}" wx:for-item="goods_list"  wx:for="{{item.order_goods}}">
-        <view class='order_content'>
+        <view class='order_content align_center'>
         <view class='order_image'>
           <image style='width:140rpx;' mode='widthFix' src='{{goods_list.goods_image}}'></image>
         </view>

+ 5 - 4
pages/order_tabs/orderTabs.wxss

@@ -67,7 +67,8 @@
   color: grey;
   border: 1rpx solid grey;
   border-radius: 5rpx;
-  padding: 0 10rpx;
+  padding: 10rpx 16rpx;
+  
   margin: 15rpx;
   font-size: 22rpx;
 }
@@ -78,7 +79,7 @@
   display:inline-block;
 }
 .order_amount {
-  color: #eb4e4f;
+  color: #333;
 }
 
 .tabs {
@@ -100,8 +101,8 @@
 }
 
 .selected {
-  color: #eb4e4f;
-  border-bottom: 3px solid #eb4e4f; 
+  color: #333;
+  border-bottom: 3px solid #2b2b2b; 
 }
 
 .empty_order {

+ 8 - 19
pages/person/person.js

@@ -19,6 +19,7 @@ Page({
     pre_send_count: 0, // 待发货 20
     pre_receive_count: 0, // 待收货 30
     evaluate_count: 0, // 已收货 40
+    bonus_total: 0
     
   },
 
@@ -101,31 +102,15 @@ Page({
             let state_name = ''
             if(order_count[i]['order_state'] == 10) {
               state_name = 'pre_pay_count'
-              // self.setData({
-              //   pre_pay_count: order_count[i]['count']
-              // })
-              // continue
             }
             if(order_count[i]['order_state'] == 20) {
               state_name = 'pre_send_count'
-              // self.setData({
-              //   pre_send_count: order_count[i]['count']
-              // })
-              // continue
             }
             if(order_count[i]['order_state'] == 30) {
               state_name = 'pre_receive_count'
-              // self.setData({
-              //   pre_receive_count: order_count[i]['count']
-              // })
-              // continue
             }
             if(order_count[i]['order_state'] == 40) {
               state_name = 'evaluate_count'
-              // self.setData({
-              //   evaluate_count: order_count[i]['count']
-              // })
-              // continue
             }
             if(state_name) {
               self.setData({
@@ -137,11 +122,15 @@ Page({
       }
     })
     getReq({
-      act: 'member_talk',
-      op: 'authon'
+      act: 'member_bonus',
+      op: 'predepositex'
     }, function (res) {
       if (res.code == 200) {
-        console.log('member_talk:', res);
+        console.log('member_bonus:', res);
+        let { bonus_total } = res.datas
+        self.setData({
+          bonus_total
+        })
       }
     })
 

+ 5 - 5
pages/person/person.wxml

@@ -5,11 +5,11 @@
       <view class="card_content">
         <view class="card_title">红包余额</view>
         <view class="bonus_balance">
-          <text class="f34 mr10">¥</text>120.00</view>
-        <view class="mt15">
-          <text class="bonus_balance_detail">红包明细></text>
-        </view>
-        <view class="use_bonus_rules">红包使用规则></view>
+          <text class="f34 mr10">¥</text>{{bonus_total}}</view>
+        <!-- <view class="mt15">
+          <text class="bonus_balance_detail">></text>
+        </view> -->
+        <view class="use_bonus_rules mt">红包使用规则></view>
       </view>
     </div>
   </view>

+ 1 - 0
pages/person/person.wxss

@@ -194,6 +194,7 @@ line-height: 44rpx;
 }
 .use_bonus_rules {
   margin-right: 20rpx;
+  margin-top: 60rpx;
   font-size: 22rpx;
   color: #FFFFFF;
   text-align: right;

+ 288 - 0
pages/shopCart/shopCart.1.js

@@ -0,0 +1,288 @@
+const getReq = require('./../../config.js').getReq;
+Page({
+  data: {
+    free_info: [],
+    summary: [],
+    cart_list: [],
+    all_checked: false,
+    allPrice: 0,
+    allGoodsPrice: 0,
+    hasmore: false,
+    curpage:0
+  },
+  onLoad: function () {
+
+  },
+  onShow: function () {
+    this.setData({
+      free_info: [],
+      summary: [],
+      cart_list: [],
+      all_checked: false,
+      allPrice: 0,
+      allGoodsPrice: 0,
+      hasmore: false,
+      curpage: 0
+    });
+    this.req_datas();
+  },
+  req_datas(){
+    let self = this;
+    wx.showLoading({
+      title: '加载中',
+    });
+    getReq({
+      act: 'cart',
+      op: 'list',
+      minest_cartid: self.data.curpage
+    }, function (res) {
+      if (res.code == 200) {
+        console.log('res.datas:', res.datas);
+        let hasmore = res.datas.mobile_page.hasmore;
+        let free_info = res.datas.free_info;
+        let summary_datas = res.datas.summary;
+        let cart_list = res.datas.cart_list;
+        let summary = [];
+        if (cart_list.length <= 0) {
+          self.setData({
+            free_info: free_info || self.data.free_info
+          });
+          wx.hideLoading();
+          return;
+        }
+        for (let item of cart_list) {
+          item.checked = false;
+        }
+        for (let i = 0; i < cart_list.length; i++) {
+          for (let j = 0; j < summary_datas.length; j++) {
+            if (cart_list[i].goods_id == summary_datas[j].goods_id) {
+              summary.push(summary_datas[j]);
+              continue;
+            }
+          }
+        }
+        if (hasmore) {
+          let lastCartListId = cart_list[cart_list.length - 1].cart_id;
+          self.setData({
+            hasmore: true,
+            curpage: lastCartListId
+          })
+        }
+        else {
+          self.setData({
+            hasmore: false
+          })
+        }
+        let localSummary = self.data.summary;
+        let localCartList = self.data.cart_list;
+        console.log('sumary:', summary);
+        self.setData({
+          free_info: free_info || self.data.free_info,
+          summary: localSummary.concat(summary),
+          cart_list: localCartList.concat(cart_list)
+        });
+        wx.hideLoading();
+      }
+    })
+  },
+  goods_checked(e) {
+    let goods_id = e.currentTarget.dataset.goodsid;
+    let cart_list = this.data.cart_list;
+    let all_checked_state = 0;
+    for (let item of cart_list) {
+      if (item.goods_id == goods_id) {
+        item.checked = !item.checked;
+      }
+    }
+    for (let item of cart_list) {
+      if (item.checked) {
+        all_checked_state = all_checked_state + 1;
+      }
+    }
+
+    if (all_checked_state == cart_list.length) {
+      all_checked_state = true;
+    }
+    else {
+      all_checked_state = false;
+    }
+    this.setData({
+      cart_list,
+      all_checked: all_checked_state
+    });
+    this.total();
+  },
+  all_checked() {
+    let cart_list = this.data.cart_list;
+    let all_checked_state = this.data.all_checked;
+    for (let item of cart_list) {
+      item.checked = !all_checked_state;
+    }
+    this.setData({
+      cart_list,
+      all_checked: !all_checked_state
+    });
+    this.total();
+  },
+  req_goods_num(cart_id, quantity,callback){
+    let self = this;
+    getReq({
+      act: 'cart',
+      op: 'edit',
+      cart_id,
+      quantity
+    }, function (res) {
+      if (res.code == 200) {
+        let goods_num = res.datas.goods_num;
+        let cart_list = self.data.cart_list;
+        for (let item of cart_list) {
+          if (item.cart_id == cart_id) {
+            item.goods_num = goods_num;
+          }
+        }
+        self.setData({
+          cart_list
+        });
+        callback;
+        for (let i = 0; i < self.data.cart_list.length;i++) {
+          if (self.data.cart_list[i].checked) {
+            self.total();
+            break;
+          }
+        }
+      }
+      else {
+        wx.showToast({
+          title:res.message,
+          icon:"none"
+        })
+      }
+    })
+  },
+  goods_num_handle(e) {
+    let self = this;
+    let cart_id = e.target.dataset.cartid;
+    let num = e.target.dataset.num;
+    let compute_function = e.target.dataset.function;
+    let goods_id = e.target.dataset.goodsid;
+    let quantity = 1;
+    if (compute_function == 'add') {
+      quantity = num + quantity;
+      this.req_goods_num(cart_id, quantity);
+    }
+    else {
+      quantity = num - quantity;
+      if (quantity <= 0) {
+        this.cancal_cart(e,goods_id, cart_id);
+      }
+      else {
+        self.req_goods_num(cart_id, quantity);
+      }
+    }
+  },
+  del_cart(cart_id, goods_id) {
+    let summary = this.data.summary;
+    let cart_list = this.data.cart_list;
+    for (let i = 0; i < summary.length;i++) {
+      if (summary[i].goods_id == goods_id) {
+        summary.splice(i,1);
+      }
+    }
+    for (let i = 0; i < cart_list.length; i++) {
+      if (cart_list[i].goods_id == goods_id) {
+        cart_list.splice(i,1);
+      }
+    }
+    this.setData({
+      summary,
+      cart_list
+    })
+  },
+  cancal_cart(e,goodsid,cartid){
+    let self = this;
+    let goods_id = e.target.dataset.goodsid || goodsid;
+    let cart_id = e.target.dataset.cartid || cartid;
+    wx.showModal({
+      title: "提示",
+      content: "确定要删除吗?",
+      success: function (res) {
+        if (res.confirm) {
+          self.req_goods_num(cart_id, 0, self.del_cart(cart_id, goods_id));
+        } else if (res.cancel) {
+          return;
+        }
+      }
+    })
+  },
+  total(){
+    let self = this;
+    let cart_item = [];
+    for (let item of this.data.cart_list){
+      if(item.checked){
+        cart_item.push(item.cart_id);
+      }
+    }
+    if(cart_item.length <= 0) {
+      self.setData({
+        allPrice:0,
+        allGoodsPrice:0
+      })
+    }
+    let carts = cart_item.join(",");
+    getReq({
+      act: 'member_buy',
+      op: 'calc_cash',
+      ifcart: 1,
+      cart_id: carts
+    }, function (res) {
+      if (res.code == 200) {
+        let datas = res.datas.payinfo;
+        let allPrice = parseFloat((datas.goods_amount + datas.freight - datas.available_pred - datas.full_discount - datas.opgoods_discount).toFixed(2));
+        let allGoodsPrice = parseFloat((datas.goods_amount).toFixed(2));
+        self.setData({
+          allPrice,
+          allGoodsPrice
+        })
+      }
+    })
+  },
+  onReachBottom(){
+    let self = this;
+    let hasmore = this.data.hasmore;
+    if(hasmore) {
+      
+      let req_curpage = this.data.curpage;
+      getReq({
+        act: 'cart',
+        op: 'list',
+        minest_cartid: req_curpage
+      }, function (res) {
+        self.req_datas();
+      })
+    }
+  },
+  settlement(){
+    const cart_id_list = [];
+    for (let cart_item of this.data.cart_list) {
+      if (cart_item.checked) {
+        cart_id_list.push(cart_item.cart_id);
+      }
+    }
+    if (cart_id_list.length <= 0) {
+      wx.showToast({
+        title:"请最少选择一件商品",
+        icon:"none"
+      });
+      return;
+    }
+    let cart_list = cart_id_list.join(',');
+    wx.navigateTo({
+      url: `/pages/confirmOrder/confirmOrder?iscart=1&cart_id=${cart_list}`
+    })
+  },
+  skip_index(){
+    wx.switchTab({
+      url:"/pages/index/index"
+    })
+  }
+})

+ 74 - 0
pages/shopCart/shopCart.1.wxml

@@ -0,0 +1,74 @@
+<!-- <view class='cell_box' wx:if="{{free_info.length}}">
+  <block wx:for="{{free_info}}" wx:key="{{index}}">
+    <view class='cell_item'>
+      <text class='cell_item_title'>{{item.title}}</text>
+      <text class='cell_item_value'>{{item.value}}</text>
+    </view>
+  </block>
+</view> -->
+<view style='background:#fff;' wx:if="{{summary.length <= 0}}">
+  <view class='flex_center'>
+    <image style='width:200rpx;' mode='widthFix' src='../../image/empty_cart.png'></image>
+  </view>
+  <view  class='flex_center'>
+    <text style='font-size:26rpx;color:#a1a1a1;'>您的购物车没有商品哦!</text>
+  </view>
+  <view class='flex_center'>
+    <button size='mini' bindtap='skip_index'  style='margin:20rpx 0;background: #2b2b2b;' type='warn'>去逛逛</button>
+  </view>
+</view>
+<view class='cart_list'>
+  <block wx:for="{{summary}}" wx:key="{{index}}">
+    <view class='cart_item'>
+      <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}"></icon>
+      <view class='check_btn' data-goodsid="{{cart_list[index]['goods_id']}}" bindtap='goods_checked'>
+        <block wx:if="{{cart_list[index]['checked']}}">
+          <icon type="success" size="21" color="#333"></icon>
+        </block>
+        <block wx:else>
+          <view class="icon_empty"></view>
+        </block>
+      </view>
+      <view class='goods_image'>
+        <image mode='scaleToFill' src="{{item.goods_image_url}}"></image>
+      </view>
+      <view class='goods_content'>
+        <view class='goods_name one_line_hidden'>{{item.goods_mobile_name}}</view>
+        <view class='goods_spec one_line_hidden'>{{item.goods_spec}}</view>
+        <view class='goods_price'>
+          <text class="bonus_price">¥{{item.bonus_price}}</text>
+          <text class="original_price">专柜价{{item.goods_price}}</text>
+        </view>
+        <view class='num_handle'>
+          <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}" data-function='minus' data-num="{{cart_list[index]['goods_num']}}">-</text>
+          <block>
+            <text class='num'>{{cart_list[index]['goods_num']}}</text>
+          </block>
+          <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}" data-function='add' data-num="{{cart_list[index]['goods_num']}}">+</text>
+        </view>
+      </view>
+    </view>
+  </block>
+  <view class='clear_fixed'></view>
+</view>
+
+<view class="handle_fixed">
+  <view class="all_check_btn" bindtap='all_checked'>
+    <block wx:if="{{all_checked}}">
+      <icon type="success" size="21" color="#333" style='margin-right:22rpx;position:relative;top:7rpx;'></icon>
+    </block>
+    <block wx:else>
+      <view class="icon_empty" style='position:relative;bottom:5rpx;'></view>
+    </block>
+    <text>全选</text>
+  </view>
+  <view style='float:right'>
+    <view class='cope'>
+      <text class='bonus_price'>应付:¥{{allPrice}}</text>
+      <text class="original_price">¥{{allGoodsPrice}}</text>
+    </view>
+    <view class='settlement_btn' bindtap='settlement'>
+      <text>结算</text>
+    </view>
+  </view>
+</view>

+ 79 - 26
pages/shopCart/shopCart.js

@@ -1,14 +1,16 @@
 const getReq = require('./../../config.js').getReq;
+import Bundle from '../../utils/Bundle'
 Page({
   data: {
     free_info: [],
     summary: [],
     cart_list: [],
+    n_cart_list: [],
     all_checked: false,
     allPrice: 0,
     allGoodsPrice: 0,
     hasmore: false,
-    curpage:0
+    curpage: 0
   },
   onLoad: function () {
 
@@ -18,6 +20,7 @@ Page({
       free_info: [],
       summary: [],
       cart_list: [],
+      n_cart_list: [],
       all_checked: false,
       allPrice: 0,
       allGoodsPrice: 0,
@@ -25,8 +28,47 @@ Page({
       curpage: 0
     });
     this.req_datas();
+    // this.getDatas()
   },
-  req_datas(){
+  getDatas() {
+    let self = this;
+    wx.showLoading({
+      title: '加载中',
+    })
+
+    getReq({
+      act: 'cart',
+      op: 'list',
+      minest_cartid: self.data.curpage
+    }, function (res) {
+      if (res.code == 200) {
+        wx.hideLoading()
+        let { cart_list, summary, bundling } = res.datas
+        let n_cart_list = self.getCartList(cart_list, summary, bundling)
+        self.setData({
+          n_cart_list
+        })
+
+      }
+    })
+
+  },
+  getCartList(cart_list, summary, bundling) {
+    let summaryMap = new Map()
+    let bundlingMap = new Map()
+    summary.map(item => {
+      summaryMap.set(item['goods_id'], item)
+    })
+    if (bundling.length) {
+      bundling.map(item => {
+        bundlingMap.set(item['bl_id'], item)
+      })
+    }
+    let n_cart_list = new Bundle(cart_list, summaryMap, bundlingMap).createOrders()
+    return n_cart_list
+  },
+
+  req_datas() {
     let self = this;
     wx.showLoading({
       title: '加载中',
@@ -36,11 +78,18 @@ Page({
       op: 'list',
       minest_cartid: self.data.curpage
     }, function (res) {
+
       if (res.code == 200) {
         let hasmore = res.datas.mobile_page.hasmore;
         let free_info = res.datas.free_info;
         let summary_datas = res.datas.summary;
         let cart_list = res.datas.cart_list;
+
+        let bundling = res.datas.bundling
+        // let { cart_list, summary, bundling } = res.datas
+        // let n_cart_list = self.getCartList(cart_list, summary, bundling)
+
+        
         let summary = [];
         if (cart_list.length <= 0) {
           self.setData({
@@ -56,7 +105,7 @@ Page({
           for (let j = 0; j < summary_datas.length; j++) {
             if (cart_list[i].goods_id == summary_datas[j].goods_id) {
               summary.push(summary_datas[j]);
-              continue;
+              break;
             }
           }
         }
@@ -72,6 +121,10 @@ Page({
             hasmore: false
           })
         }
+        cart_list = self.getCartList(cart_list, summary_datas, bundling);
+
+
+
         let localSummary = self.data.summary;
         let localCartList = self.data.cart_list;
         self.setData({
@@ -122,7 +175,7 @@ Page({
     });
     this.total();
   },
-  req_goods_num(cart_id, quantity,callback){
+  req_goods_num(cart_id, quantity, callback) {
     let self = this;
     getReq({
       act: 'cart',
@@ -142,7 +195,7 @@ Page({
           cart_list
         });
         callback;
-        for (let i = 0; i < self.data.cart_list.length;i++) {
+        for (let i = 0; i < self.data.cart_list.length; i++) {
           if (self.data.cart_list[i].checked) {
             self.total();
             break;
@@ -151,8 +204,8 @@ Page({
       }
       else {
         wx.showToast({
-          title:res.message,
-          icon:"none"
+          title: res.message,
+          icon: "none"
         })
       }
     })
@@ -171,7 +224,7 @@ Page({
     else {
       quantity = num - quantity;
       if (quantity <= 0) {
-        this.cancal_cart(e,goods_id, cart_id);
+        this.cancal_cart(e, goods_id, cart_id);
       }
       else {
         self.req_goods_num(cart_id, quantity);
@@ -181,14 +234,14 @@ Page({
   del_cart(cart_id, goods_id) {
     let summary = this.data.summary;
     let cart_list = this.data.cart_list;
-    for (let i = 0; i < summary.length;i++) {
+    for (let i = 0; i < summary.length; i++) {
       if (summary[i].goods_id == goods_id) {
-        summary.splice(i,1);
+        summary.splice(i, 1);
       }
     }
     for (let i = 0; i < cart_list.length; i++) {
       if (cart_list[i].goods_id == goods_id) {
-        cart_list.splice(i,1);
+        cart_list.splice(i, 1);
       }
     }
     this.setData({
@@ -196,7 +249,7 @@ Page({
       cart_list
     })
   },
-  cancal_cart(e,goodsid,cartid){
+  cancal_cart(e, goodsid, cartid) {
     let self = this;
     let goods_id = e.target.dataset.goodsid || goodsid;
     let cart_id = e.target.dataset.cartid || cartid;
@@ -212,18 +265,18 @@ Page({
       }
     })
   },
-  total(){
+  total() {
     let self = this;
     let cart_item = [];
-    for (let item of this.data.cart_list){
-      if(item.checked){
+    for (let item of this.data.cart_list) {
+      if (item.checked) {
         cart_item.push(item.cart_id);
       }
     }
-    if(cart_item.length <= 0) {
+    if (cart_item.length <= 0) {
       self.setData({
-        allPrice:0,
-        allGoodsPrice:0
+        allPrice: 0,
+        allGoodsPrice: 0
       })
     }
     let carts = cart_item.join(",");
@@ -244,11 +297,11 @@ Page({
       }
     })
   },
-  onReachBottom(){
+  onReachBottom() {
     let self = this;
     let hasmore = this.data.hasmore;
-    if(hasmore) {
-      
+    if (hasmore) {
+
       let req_curpage = this.data.curpage;
       getReq({
         act: 'cart',
@@ -259,7 +312,7 @@ Page({
       })
     }
   },
-  settlement(){
+  settlement() {
     const cart_id_list = [];
     for (let cart_item of this.data.cart_list) {
       if (cart_item.checked) {
@@ -268,8 +321,8 @@ Page({
     }
     if (cart_id_list.length <= 0) {
       wx.showToast({
-        title:"请最少选择一件商品",
-        icon:"none"
+        title: "请最少选择一件商品",
+        icon: "none"
       });
       return;
     }
@@ -278,9 +331,9 @@ Page({
       url: `/pages/confirmOrder/confirmOrder?iscart=1&cart_id=${cart_list}`
     })
   },
-  skip_index(){
+  skip_index() {
     wx.switchTab({
-      url:"/pages/index/index"
+      url: "/pages/index/index"
     })
   }
 })

+ 70 - 26
pages/shopCart/shopCart.wxml

@@ -1,54 +1,98 @@
-<!-- <view class='cell_box' wx:if="{{free_info.length}}">
-  <block wx:for="{{free_info}}" wx:key="{{index}}">
-    <view class='cell_item'>
-      <text class='cell_item_title'>{{item.title}}</text>
-      <text class='cell_item_value'>{{item.value}}</text>
-    </view>
-  </block>
-</view> -->
 <view style='background:#fff;' wx:if="{{summary.length <= 0}}">
   <view class='flex_center'>
     <image style='width:200rpx;' mode='widthFix' src='../../image/empty_cart.png'></image>
   </view>
-  <view  class='flex_center'>
+  <view class='flex_center'>
     <text style='font-size:26rpx;color:#a1a1a1;'>您的购物车没有商品哦!</text>
   </view>
   <view class='flex_center'>
-    <button size='mini' bindtap='skip_index'  style='margin:20rpx 0;background: #2b2b2b;' type='warn'>去逛逛</button>
+    <button size='mini' bindtap='skip_index' style='margin:20rpx 0;background: #2b2b2b;' type='warn'>去逛逛</button>
   </view>
 </view>
+
+
+
+
+
+
 <view class='cart_list'>
-  <block wx:for="{{summary}}" wx:key="{{index}}">
+  <block wx:for="{{cart_list}}" wx:key="*this">
+  <!-- 套餐情况下循环 -->
+  <block wx:if="{{item['bl_id'] > 0}}">
+    <view class="mb10">
+    <view class="bundl_title">{{item['bl_name']}}</view>
     <view class='cart_item'>
-      <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}"></icon>
-      <view class='check_btn' data-goodsid="{{cart_list[index]['goods_id']}}" bindtap='goods_checked'>
-        <block wx:if="{{cart_list[index]['checked']}}">
+      <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"></icon>
+      <view class='check_btn' data-goodsid="{{item['goods_id']}}" bindtap='goods_checked'>
+        <block wx:if="{{item['checked']}}">
           <icon type="success" size="21" color="#333"></icon>
         </block>
         <block wx:else>
           <view class="icon_empty"></view>
         </block>
       </view>
+
+      <view>
+        <view class="align_center mb20" wx:for="{{item['goods']}}" wx:for-index="bl_index" wx:for-item="bl_item" wx:key="bl_index">
+          <view class='goods_image'>
+            <image mode='scaleToFill' src="{{bl_item['goods_summary']['goods_image_url']}}"></image>
+          </view>
+          <view class='goods_content'>
+            <view class='goods_name one_line_hidden'>{{bl_item['goods_summary']['goods_mobile_name']}}</view>
+            <view class='goods_spec one_line_hidden'>{{bl_item['goods_summary']['goods_spec']}}</view>
+            <view class='goods_price'>
+              <text class="bonus_price">¥{{bl_item['bl_goods_price']}}</text>
+              <text class="original_price">专柜价{{bl_item['goods_summary']['goods_price']}}</text>
+            </view>
+          </view>
+        </view>
+      </view>
+      <view class='num_handle align_center'>
+        <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}" data-function='minus' data-num="{{item['goods_num']}}">-</text>
+        <block>
+          <text class='num'>{{item['goods_num']}}</text>
+        </block>
+        <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}" data-function='add' data-num="{{item['goods_num']}}">+</text>
+      </view>
+    </view>
+    <view class="bundle_price"><text>套装价:</text><text class="ft_bold col333">¥{{item['bl_price']}}</text> <text class="line-through col666 ml10">专柜价{{item['totalPrice']}}</text></view>
+  </view>
+  </block>
+
+  <!-- 非套餐情况下循环 -->
+  <block wx:if="{{item['bl_id'] == 0}}">
+    <view class='cart_item mb10'>
+      <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"></icon>
+      <view class='check_btn' data-goodsid="{{item['goods_id']}}" bindtap='goods_checked'>
+        <block wx:if="{{item['checked']}}">
+            <icon type="success" size="21" color="#333"></icon>
+          </block>
+          <block wx:else>
+            <view class="icon_empty"></view>
+          </block>
+      </view>
       <view class='goods_image'>
-        <image mode='scaleToFill' src="{{item.goods_image_url}}"></image>
+        <image mode='scaleToFill' src="{{item['goods_summary']['goods_image_url']}}"></image>
       </view>
       <view class='goods_content'>
-        <view class='goods_name one_line_hidden'>{{item.goods_mobile_name}}</view>
-        <view class='goods_spec one_line_hidden'>{{item.goods_spec}}</view>
+        <view class='goods_name one_line_hidden'>{{item['goods_summary']['goods_mobile_name']}}</view>
+        <view class='goods_spec one_line_hidden'>{{item['goods_summary']['goods_spec']}}</view>
         <view class='goods_price'>
-          <text class="bonus_price">¥{{item.bonus_price}}</text>
-          <text class="original_price">专柜价{{item.goods_price}}</text>
-        </view>
-        <view class='num_handle'>
-          <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}" data-function='minus' data-num="{{cart_list[index]['goods_num']}}">-</text>
-          <block>
-            <text class='num'>{{cart_list[index]['goods_num']}}</text>
-          </block>
-          <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{cart_list[index]['goods_id']}}" data-cartid="{{cart_list[index]['cart_id']}}" data-function='add' data-num="{{cart_list[index]['goods_num']}}">+</text>
+          <text class="bonus_price" wx:if="{{item['goods_summary']['act_type'] == 0}}">¥{{item['goods_summary']['bonus_price']}}</text>
+          <text class="original_price" wx:if="{{item['goods_summary']['act_type'] == 2}}">专柜价{{item['goods_summary']['goods_promotion_price']}}</text>
         </view>
       </view>
+      <view class='num_handle'>
+        <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}" data-function='minus' data-num="{{item['goods_num']}}">-</text>
+        <block>
+          <text class='num'>{{item['goods_num']}}</text>
+        </block>
+        <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}" data-function='add' data-num="{{item['goods_num']}}">+</text>
+      </view>
     </view>
+  
   </block>
+</block>
   <view class='clear_fixed'></view>
 </view>
 

+ 21 - 2
pages/shopCart/shopCart.wxss

@@ -107,7 +107,7 @@
 }
 .cart_item {
   background: #ffffff;
-  margin-bottom: 8rpx;
+  /* margin-bottom: 8rpx; */
   position: relative;
   padding: 20rpx 0;
   display: flex;
@@ -126,6 +126,9 @@
   display: flex;
   justify-content: center;
   align-items:center;
+
+  /* add */
+  height: 160rpx;
 }
 .check_btn .icon_empty {
   margin-right: 0;
@@ -146,19 +149,22 @@
   position: absolute;
   bottom: 20rpx;
   right: 10rpx;
+  font-size: 0;
   /* border: 1px solid #CFCFCF; */
   /* border-radius: 6rpx; */
 }
 .handle_btn {
     color: #999;
     display: inline-block;
+    /* vertical-align: middle; */
     width: 60rpx;
     text-align: center;
     font-size: 40rpx;
 }
 .num {
-    font-size: 24rpx;
+    font-size: 30rpx;
     display: inline-block;
+    /* vertical-align: middle; */
     width: 40rpx;
     text-align: center;
     color: #333;
@@ -173,4 +179,17 @@
   width: 40rpx;
   height: 40rpx;
   z-index: 10;
+}
+.bundl_title {
+  padding-left: 90rpx;
+  background: #fff;
+  font-size: 30rpx;
+  color: #333;
+  font-weight: bold;
+}
+.bundle_price {
+  padding: 10rpx 0 10rpx 90rpx;
+  background: #fff;
+  line-height: 42rpx;
+  font-size: 24rpx;
 }

+ 49 - 0
utils/Bundle.js

@@ -0,0 +1,49 @@
+/**
+ * @params sumary  Map() 所有数据的集合
+ * @params bundling  Map() 套装数据的集合
+ * @params goods_list  需要遍历的数据 array, 每个item是object, goods_id, goods_num, bl_id // bl_id > 0,查bundling 反之goods_id查sumary
+ */
+// bl_id: 12, bl_name: "222", bl_price: 122, goods: Array(4), goods_num: 3 有套餐返回的数据样式, 渲染时判断bl_id 再循环goods即可。。。 goods_num通用
+// goods_id: 4807, goods_num: 1, bl_id: 0, goods_summary{} 无套餐返回的数据样式, 渲染时取goods_summary数据即可
+
+ 
+
+export default class Bundle {
+  constructor(goods_list,sumary,bundling) {
+    this.goods_list = goods_list
+    this.sumary = sumary
+    this.bundling = bundling
+    // this.createOrders()
+  }
+
+  createOrders() {
+    let arr = []
+    this.goods_list.map(item => {
+      if(item['bl_id'] > 0) {
+        // 有套餐, 生成套餐数据
+        let data = this.createBuildings(item)
+        data = Object.assign({}, item, data)
+        // data['goods_num'] = item['goods_num']
+        let totalPrice = 0;
+        data['goods'].map(value => {
+          value['goods_summary'] = this.sumary.get(value['goods_id'])
+          totalPrice += parseFloat(value['goods_summary']['goods_price'])
+        })
+        data['totalPrice'] = totalPrice
+        arr.push(data)
+      }
+      else {
+        let defaultData = this.createDefault(item)
+        item['goods_summary'] = defaultData
+        arr.push(item)
+      }
+    })
+    return arr
+  }
+  createBuildings(item) {
+    return this.bundling.get(item['bl_id'])
+  }
+  createDefault(item) {
+    return this.sumary.get(item['goods_id'])
+  }
+}