huanggang 7 tahun lalu
induk
melakukan
6e882c627a

+ 0 - 1
Proxy.js

@@ -1,6 +1,5 @@
 
 let getSummeryGoods = function (goods_id, summery){
-  console.log()
   for (let i = 0; i < summery.length; i++) {
     let summery_goods = summery[i];
     if (summery_goods['goods_id'] == goods_id) {

+ 2 - 1
app.json

@@ -14,7 +14,8 @@
     "pages/order_tabs/orderTabs",
     "pages/address/address",
     "pages/addAddress/addAddress",
-    "pages/orderPaySn/orderPaySn"
+    "pages/orderPaySn/orderPaySn",
+    "pages/fcode/fcode"
   ],
   "window": {
     "backgroundTextStyle": "dark",

TEMPAT SAMPAH
image/tabbar/tabbar_home_default@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_home_hight@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_set_default@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_set_hight@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_shopcar_default@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_shopcar_hight@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_shopguide_default@2x.png


TEMPAT SAMPAH
image/tabbar/tabbar_shopguide_hight@2x.png


+ 72 - 8
pages/components/blockItem/blockItem.js

@@ -6,19 +6,84 @@ Component({
   properties: {
     item_data: {
       type:Object
+    },
+    summery:{
+      type:Array
+    },
+    special_datas:{
+      type:Object,
+      value:{}
     } 
   },
 
-  ready(){
-    // console.log(this.properties.item_data);
-  },
+  ready() {
+    if (!(this.properties.special_datas).hasOwnProperty('fcodes')){
+      return;
+    }
+    const fcodes = this.properties.special_datas.fcodes;
+    const goods_id = this.properties.item_data.data;
+    const summery = this.properties.summery;
+    let fcode = {};
+    for (let item of summery) {
+      if (item.goods_id == goods_id){
+        this.setData({
+          goods:item
+        })
+        break;
+      }
+    }
+    for (let item of fcodes){
+      if (item.goods_id == goods_id) {
+        fcode = item; 
+        break;
+      }
+    }
+    fcode.usable_time = (function(time){
+      let date = new Date(time * 1000);
+      let year = date.getFullYear();
+      let month = date.getMonth() + 1;
+      let day = date.getDate();
+      return `${year}.${month}.${day}`;
+    })(fcode.usable_time);
 
+    fcode.state = (function(state){
+      let bgColor = '';
+      let title = '';
+      switch (state) {
+        case 0:
+          bgColor = "#ffa82d";
+          title = "可使用";
+          break;
+        case 1:
+          bgColor = "#bfbfbf";
+          title = "已用完";
+          break;
+        case 2:
+          bgColor = "#bfbfbf";
+          title = "已过期";
+          break;
+        case 3:
+          bgColor = "#7e7e7e";
+          title = '已锁定';
+          break;
+      }
+      return {
+        bgColor: bgColor,
+        title: title
+      }
+    })(fcode.state);
+    this.setData({
+      fcode:fcode
+    })
+  },
 
   /**
    * 组件的初始数据
    */
   data: {
-    imgShow:false
+    imgShow:false,
+    goods: {},
+    fcode: {}
   },
 
   /**
@@ -26,9 +91,9 @@ Component({
    */
   methods: {
     navigator(e){
-      const type = e.target.dataset.type;
-      const target_data = e.target.dataset.target;
-      const title = e.target.dataset.title;
+      const type = e.target.dataset.type || e.currentTarget.dataset.type;
+      const target_data = e.target.dataset.target || e.currentTarget.dataset.target;
+      const title = e.target.dataset.title || e.currentTarget.dataset.title;
       if(!type)return;
       switch(type){
         case "url":{
@@ -62,7 +127,6 @@ Component({
       }
     },
     load(e){
-    
       this.setData({
         imgShow:true
       });

+ 23 - 1
pages/components/blockItem/blockItem.wxml

@@ -11,4 +11,26 @@
         <text class='ugc_title'>{{item_data.title}}</text>
     </view>
     <image src="{{item_data.image}}" bindload='load' class='{{imgShow? "show" : "hide"}}' data-type="{{item_data.type}}" bindtap="navigator" data-target="{{item_data.data}}" mode='widthFix' lazy-load="true" data-title="{{item_data.title}}"></image>
-</block> 
+</block> 
+
+<block wx:elif="{{item_data.show_type == 'fcode'|| item_data.type == 'fcode'}}">
+    <view class='fcode_item' data-target="{{item_data.data}}" bindtap="navigator" data-type="{{item_data.type}}">
+      <view class='fcode_goods'>
+        <view>
+          <image src='{{goods.goods_image_url}}' mode='widthFix'></image>
+        </view>
+        <view>
+          <view>{{goods.goods_mobile_name}}</view>
+          <view class='fcode'>{{fcode.fcode}}</view>
+        </view>
+      </view>
+      <view class='fcode_content'>
+        <view class='validity'>
+           <text>有效期至{{fcode.usable_time}}</text> 
+        </view>
+        <view class='fcode_state'>
+            <text style="background-color:{{fcode.state.bgColor}}">{{fcode.state.title}}</text>
+        </view>
+      </view>
+    </view>
+</block>

+ 50 - 0
pages/components/blockItem/blockItem.wxss

@@ -14,4 +14,54 @@
 }
 .hide {
   opacity: 0;
+}
+.fcode_item {
+  font-size: 24rpx;
+  background: #ffffff;
+}
+.fcode_goods {
+  position: relative;
+  display: flex;
+  width: 100%;
+  padding: 25rpx 0 25rpx 25rpx;
+}
+.fcode_goods image{
+  border: 2rpx solid #D9D9D9;
+  margin-right: 24rpx;
+  width:106rpx; 
+}
+.fcode_goods fcode {
+  font-size: 20rpx;
+}
+.fcode_goods::after {
+  content: " ";
+  position: absolute;
+  left: 0;
+  bottom: 0;
+  right: 0;
+  height: 1px;
+  border-bottom: 1px solid #D9D9D9;
+  color: #D9D9D9;
+  -webkit-transform-origin: 0 100%;
+  transform-origin: 0 100%;
+  -webkit-transform: scaleY(0.5);
+  transform: scaleY(0.5);
+}
+.fcode_content {
+  display: flex;
+  width: 100%;
+  height: 67rpx;
+  line-height: 67rpx;
+  padding: 0 25rpx;
+  box-sizing: border-box;
+}
+.fcode_content>view {
+  flex: 1;
+}
+.fcode_content .fcode_state {
+  text-align: right;
+}
+.fcode_content .fcode_state text {
+  padding: 8rpx 20rpx;
+  border-radius: 30rpx;
 }

+ 1 - 1
pages/components/blockList/blockList.wxml

@@ -2,7 +2,7 @@
     <carousel wx:if="{{item.item_type == 'adv_list'}}" image_list="{{item.items}}" scale="{{item.scale}}"></carousel>
     <divider wx:if="{{item.item_type == 'divider'}}" items="{{item}}"></divider> 
     <homeThree wx:if="{{item.item_type == 'home3'}}" specialData="{{item}}" items="{{item.items}}"></homeThree> 
-    <homeOne wx:if="{{item.item_type == 'home1'}}" items="{{item.items}}" ></homeOne>
+    <homeOne wx:if="{{item.item_type == 'home1'}}" special_datas="{{special_datas}}"  items="{{item.items}}" summery="{{summery}}"></homeOne>
     <homeOne wx:if="{{item.item_type == 'home5'}}" items="{{item.items}}"></homeOne>
     <homeTwo wx:if="{{item.item_type == 'home2'}}" items="{{item.items}}"></homeTwo>
     <horizon wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" items="{{item.items}}"></horizon>

+ 6 - 0
pages/components/blocks/home1/homeOne.js

@@ -6,6 +6,12 @@ Component({
   properties: {
     items: {
       type: Array
+    },
+    summery:{
+      type:Array
+    },
+    special_datas:{
+      type:Object
     }
   },
 

+ 1 - 1
pages/components/blocks/home1/homeOne.wxml

@@ -1,6 +1,6 @@
 <!--components/blocks/home1/home_one.wxml-->
 <view style="overflow:hidden;height:{{(items[0].height/1080*750)+'rpx'}}">
   <block wx:key="{{item}}" wx:for="{{items}}">
-      <blockItem item_data="{{item}}"></blockItem>  
+      <blockItem special_datas="{{special_datas}}" summery="{{summery}}" item_data="{{item}}"></blockItem>  
   </block>
 </view> 

+ 84 - 0
pages/fcode/fcode.js

@@ -0,0 +1,84 @@
+// pages/fcode/fcode.js
+const getReq = require('./../../config.js').getReq;
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    special_datas: {},
+    summery: []
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.showLoading({
+      title: '加载中'
+    });
+    let self = this
+    getReq({
+      act: 'member_fcode',
+      op: 'list'
+    }, function (res) {
+      if (res.code == 200) {
+          console.log(res);
+          self.setData({
+            special_datas: res.datas,
+            summery: res.datas.summary
+          });
+          wx.hideLoading();
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/fcode/fcode.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "blockList": "../components/blockList/blockList"
+  },
+  "navigationBarTitleText": "我的F码"
+}

+ 3 - 0
pages/fcode/fcode.wxml

@@ -0,0 +1,3 @@
+<view>
+  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList> 
+</view>

+ 1 - 0
pages/fcode/fcode.wxss

@@ -0,0 +1 @@
+/* pages/fcode/fcode.wxss */

+ 3 - 6
pages/index/index.js

@@ -1,8 +1,5 @@
-//index.js
-//获取应用实例
-const getReq = require('./../../config.js').getReq;
-const app = getApp();
 
+const getReq = require('./../../config.js').getReq;
 
 Page({
   data: {
@@ -12,7 +9,7 @@ Page({
   },
 
   onLoad: function () {
-    var self = this
+    let self = this
     getReq({
       act: 'index',
       op: 'tabs'
@@ -37,7 +34,7 @@ Page({
     wx.showLoading({
       title: '加载中'
     });
-    var self = this;
+    let self = this;
     getReq({
       act: 'special',
       op: 'index',

+ 12 - 8
pages/person/person.wxml

@@ -70,14 +70,18 @@
        </view>
     </block>
   </view>
-  <view class='item flex_1px_d'>
-    <image style='width:32rpx;' mode='widthFix' src='../../image/person/address_icon.png'></image>
-    <text class='arrow_right'>收货地址</text>
-  </view>
-  <view class='item flex_1px_d'>
-    <image style='width:32rpx;' mode='widthFix' src='../../image/person/fcode_icon.png'></image>
-    <text class='arrow_right'>我的F码</text>
-  </view>
+  <navigator url="/pages/address/address">
+    <view class='item flex_1px_d'>
+        <image style='width:32rpx;' mode='widthFix' src='../../image/person/address_icon.png'></image>
+        <text class='arrow_right'>收货地址</text>
+    </view>
+  </navigator>
+  <navigator url="/pages/fcode/fcode">
+    <view class='item flex_1px_d'>
+      <image style='width:32rpx;' mode='widthFix' src='../../image/person/fcode_icon.png'></image>
+      <text class='arrow_right'>我的F码</text>
+    </view>
+  </navigator>
   <view class='item flex_1px_d'>
     <image style='width:32rpx;' mode='widthFix' src='../../image/person/help_icon.png'></image>
     <text class='arrow_right' bindtap='skip_help'>帮助中心</text>

+ 7 - 0
pages/shopCart/shopCart.js

@@ -256,6 +256,13 @@ Page({
         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}`