Ver código fonte

我的赠券

junyuanz 4 anos atrás
pai
commit
577bc1b71a

+ 2 - 1
app.json

@@ -72,7 +72,8 @@
 		"pages/user/proxyReview/proxyReview",
 		"pages/user/userInfo/userInfo",
 		"pages/user/selfReceive/selfReceive",
-		"pages/user/selfReceive/newReceive/newReceive"
+		"pages/user/selfReceive/newReceive/newReceive",
+		"pages/user/promotion/promotion"
       ]
     },
     {

+ 69 - 0
packageUser/pages/user/promotion/promotion.js

@@ -0,0 +1,69 @@
+var _request = require('../../../../utils/request.js')
+var util = require('../../../../utils/util.js')
+Page({
+  data: {
+    page: 1,
+    per_page: 20,
+    list: [],
+    more: true,
+    balance: 0
+  },
+  onLoad: function (options) {
+    // this.getBalanceInfo()
+    this.getBalanceList()
+  },
+  onShow () {
+  },
+  onReachBottom: function () {
+    if (this.data.more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getBalanceList()
+    }
+  },
+  getBalanceInfo () {
+    var that = this
+    var url = 'v1/user/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      var result = res.data.total
+      that.setData({
+        balance: result
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  getBalanceList () {
+    var that = this
+    var url = 'v1/promotion/list'
+    var params = {
+      page: this.data.page,
+      per_page: this.data.per_page
+    }
+    var success = function (res) {
+      var result = that.data.list.concat(res.data.present || [])
+      that.setData({
+        list: result
+      })
+      var listMore = res.data.count > that.data.list.length
+      that.setData({
+        more: listMore
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  getDetail (val) {
+    var id = val.currentTarget.dataset.val
+    wx.navigateTo({
+      url: '/packageUser/pages/user/radishDetail/radishDetail?id=' + id
+    })
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_radish'
+    })
+  }
+})

+ 7 - 0
packageUser/pages/user/promotion/promotion.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "我的赠券",
+  "usingComponents": {
+    "format-time": "../../../../component/formatTime/formatTime"
+  },
+  "backgroundColor": "#f3f3f3"
+}

+ 13 - 0
packageUser/pages/user/promotion/promotion.wxml

@@ -0,0 +1,13 @@
+<view class="bg">
+  <view class="radish-main">
+    <view class="radish-main__line" wx:key="{{index}}" bindtap="getDetail" data-val="{{item.id}}" wx:for="{{list}}">
+      <view class="radish-main__left">
+        <view class="radish-main__text ellipsis">{{item.product_name}}</view>
+        <!-- <view class="radish-main__time"><format-time type="formatTime" value="{{item.ctime}}" ></format-time></view> -->
+		<view class="radish-main__time">数量:{{item.send_nums1}}</view>
+        <view class="clean"></view>
+      </view>
+      <view class="radish-main__count">{{item.source_name}}</view>
+    </view>
+  </view>
+</view>

+ 95 - 0
packageUser/pages/user/promotion/promotion.wxss

@@ -0,0 +1,95 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+}
+.radish-top {
+  width: 100%;
+  height: 360rpx;
+  background-image: url('http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/djquan.jpg');
+  background-size: 100%;
+}
+.radish-top__title {
+    padding: 95rpx 0 0;
+    font-size: 34rpx;
+    color: #FFF;
+    text-align: center;
+    text-shadow: 1px 1px 1px #bb954d;
+}
+.radish-top__count {
+    font-size: 70rpx;
+    color: #fff;
+    text-align: center;
+    text-shadow: 1px 1px 1px #e6231d;
+}
+.radish-top__btn {
+  position: absolute;
+  top: 190rpx;
+  left: 150rpx;
+  width: 196rpx;
+  height: 60rpx;
+  border: 2rpx solid #fff;
+  margin: 48rpx auto 0;
+  text-align: center;
+  line-height: 60rpx;
+  border-radius: 8rpx;
+  font-size: 28rpx;
+  color: #fff;
+}
+.radish-top__btn1 {
+    position: absolute;
+    top: 210rpx;
+    width: 206rpx;
+    height: 60rpx;
+    border: 2rpx solid #eb4d20;
+    margin: 48rpx auto 0;
+    text-align: center;
+    line-height: 60rpx;
+    border-radius: 45px;
+    font-size: 32rpx;
+    color: #fff;
+    right: calc(50% - 103rpx);
+    background: linear-gradient(to right,#eb712c,#e71f1c);
+}
+.radish-main {
+  background-color: #fff;
+}
+.radish-main__title {
+  height: 50rpx;
+  line-height: 50rpx;
+  color: #bbbbbb;
+  background-color: #f3f3f3;
+  text-align: center;
+  font-size: 24rpx;
+}
+.radish-main__line {
+  margin: 0 20rpx;
+  height: 100rpx;
+  border-bottom: 1rpx solid #eeeeee;
+}
+.radish-main__left {
+  float: left;
+  width: 450rpx;
+}
+.radish-main__text {
+  float: left;
+  padding-top: 16rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  width: 450rpx;
+}
+.radish-main__time {
+  float: left;
+  font-size: 21rpx;
+  color: #bbbbbb;
+  padding-top: 5rpx;
+}
+.radish-main__count {
+  float: right;
+  width: 260rpx;
+  font-size: 28rpx;
+  line-height: 100rpx;
+  text-align: right;
+  color: #eab86a;
+}

+ 8 - 4
pages/home/home.js

@@ -483,11 +483,15 @@ Page ({
 	  console.log('nsdata',nsdata);
       that.setData({
         seckilltimelist: seclist,
-		clock:nsdata['clock'],
+		clock:nsdata ? nsdata['clock'] : 0,
 		nowseckill_data:nsdata
       })
-      that.getkillgoods()
-      that.starttime()
+	  
+	  if(nsdata){
+		  that.getkillgoods()
+		  that.starttime()
+	  }
+      
     }
     _request.$get(url, params, success)
   },
@@ -495,7 +499,7 @@ Page ({
     var that = this
     var url = 'v1/seckill/products'
     var params = {
-      query_date: that.data.nowseckill_data != '' ? that.data.nowseckill_data['date_format'] : '',
+      query_date: that.data.nowseckill_data ? that.data.nowseckill_data['date_format'] : '',
       cache: false
     }
     var success = function (res) {

+ 5 - 0
pages/user/all/all.js

@@ -436,6 +436,11 @@ Page({
       url: '/packageUser/pages/user/bindoldsys/bindoldsys?id='+that.data.userInfo.id
     })
   },
+  toPromotion () {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/promotion/promotion'
+    })
+  },
   toIdentity () {
     wx.navigateTo({
       url: '/packageUser/pages/user/identity/identity'

+ 4 - 0
pages/user/all/all.wxml

@@ -113,6 +113,10 @@
     </view>
 -->
     <view class="user-padding">
+		<view class="user-line" bindtap="toPromotion">
+		  <view class="user-line__title">我的赠券</view>
+		  <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
+		</view>
       <view class="user-line" bindtap="toInviteList">
         <view class="user-line__title">我的推广</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>