junyuanz пре 5 година
родитељ
комит
3ead5ebe88

+ 3 - 1
app.json

@@ -60,7 +60,9 @@
         "pages/user/bindoldsys/bindoldsys",
         "pages/user/bankinfo/bankinfo",
         "pages/user/recharge/recharge",
-        "pages/user/withdraw/withdraw"
+        "pages/user/withdraw/withdraw",
+        "pages/user/transfer/transfer",
+        "pages/user/transfer/transferList/transferList"
       ]
     },
     {

+ 5 - 0
packageUser/pages/user/fund/fund.js

@@ -146,6 +146,11 @@ Page({
     }
     _request.$get(url, params, success)
   },
+  toTransfer(){
+  	wx.navigateTo({
+      url: '/packageUser/pages/user/transfer/transfer'
+    })
+  },
   goRechargeClick () {
     wx.navigateTo({
       url: '/packageUser/pages/user/recharge/recharge'

+ 2 - 0
packageUser/pages/user/fund/fund.wxml

@@ -7,6 +7,8 @@
       <view class="fund__btn withdraw" bindtap="getBankInfoAndTip" wx:if="{{cashTotal.available}}">提现</view>
       <view class="fund__btn withdrawNot" wx:if="{{!cashTotal.available}}">暂无提现</view>
       <!--<view class="fund__btn recharge" bindtap="goRechargeClick">充值</view>-->
+      
+      <view class="fund__btn withdraw" bindtap="toTransfer" disabled="{{cashTotal.available}}">转代金券</view>
       <view class="clean"></view>
     </view>
     <view wx:if="{{false}}">

+ 3 - 8
packageUser/pages/user/fund/fund.wxss

@@ -117,29 +117,22 @@
   color: #cccccc;
 }
 .fund__btnAll {
-  width: 520rpx;
+  /*width: 520rpx;*/
   margin: 0 auto;
 }
 .fund__btnAll .withdraw {
   color: #5ebf62;
   margin-right: 40rpx;
-  float: none;
-margin: 0 auto;
-  
 }
 .fund__btnAll .withdrawNot {
   background-color: #ffffff;
   color: #eab86a;
   margin-right: 40rpx;
-  float: none;
-margin: 0 auto;
-  
 }
 .fund__btnAll .recharge {
   color: #eab86a;
 }
 .fund__btn {
-  float: left;
   width: 240rpx;
   height: 80rpx;
   background: #fff;
@@ -147,6 +140,8 @@ margin: 0 auto;
   line-height: 80rpx;
   text-align: center;
   font-size: 32rpx;
+  margin: 0 25rpx;
+  display: inline-block;
 }
 .fund__modal {
   position: fixed;

+ 95 - 0
packageUser/pages/user/transfer/transfer.js

@@ -0,0 +1,95 @@
+var _request = require('../../../../utils/request.js')
+var validator = require('../../../../utils/validator.js')
+var _handle = require('../../../../utils/handle.js')
+Page({
+  data: {
+    cashTotal: '',
+    inNum:''
+  },
+  onLoad: function (options) {
+  	this.getCashTotal();
+  	this.setData({
+		      inNum:''
+		    })
+  },
+  toTransferList(){
+  	wx.navigateTo({
+      url: '/packageUser/pages/user/transfer/transferList/transferList'
+   })
+  },
+  getCashTotal () {
+    var that = this
+    var url = 'v1/user/cash/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        cashTotal: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  bindInNum: function (e) {
+    this.setData({
+      inNum: e.detail.value
+    })
+  },
+  validate () {
+    var msg
+    if (!validator.required(this.data.inNum)) {
+      msg = '请输入转换金额'
+    }
+    return { isOk: !msg, msg }
+  },
+  save: function (e) {
+    _handle.setFormId(e)
+    var { isOk, msg } = this.validate()
+    if (isOk) {
+      this.transfer()
+    } else {
+      wx.showToast({
+        title: msg,
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  transfer () {
+    var that = this
+    var url = 'v1/user/cash_transfer'
+    var params = {
+      amount:that.data.inNum*100
+    }
+    var success = function (res) {
+    	if(res.data.state){
+    		 wx.showToast({
+	        title: '转换成功!',
+	        icon: 'none',
+	        duration: 2000
+	      })
+    		 
+    		 that.getCashTotal();
+    		 that.setData({
+		      inNum:''
+		    })
+    		 setTimeout(function(){
+    		 	that.toTransferList()
+    		 },1000)
+    		 
+    	}
+    }
+    _request.$post(url, params, success)
+  },
+  bindRegionChange: function (e) {
+    console.log(e)
+    this.setData({
+      region: e.detail.value,
+      address: e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
+    })
+  },
+//onShareAppMessage: function (val) {
+//  return _request.share({
+//    sc: 'xcx_user_newaddress'
+//  })
+//}
+})

+ 4 - 0
packageUser/pages/user/transfer/transfer.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "佣金转换",
+  "backgroundColor": "#f3f3f3"
+}

+ 29 - 0
packageUser/pages/user/transfer/transfer.wxml

@@ -0,0 +1,29 @@
+<view class="bg">
+	<view bindtap="toTransferList" style="padding: 30rpx 15rpx;text-align: right;color: #eab86a;">转换明细 ></view>
+	<view class="newAddress-line">
+    <view class="newAddress-title">可用金额</view>
+    <input maxlength="11" class="nameText" value="{{cashTotal.available / 100}}" style="color:#eab86a" disabled="disabled"/>
+    <view class="clean"></view>
+  </view>
+  <view class="newAddress-line">
+    <view class="newAddress-title">转换金额</view>
+    <input maxlength="11" class="nameText" bindinput="bindInNum" placeholder="请输入转换金额" value="{{inNum}}"/>
+    <view class="clean"></view>
+  </view>
+  
+  <view class="newAddress-line">
+    <view class="newAddress-title">转出代金券</view>
+    <input maxlength="11" class="nameText" disabled="disabled" value="{{inNum * 2}}" style="color:#F44336"/>
+    <view class="clean"></view>
+  </view>
+  
+  <form bindsubmit="save" report-submit="{{true}}" class="newAddress-form">
+    <button formType="submit" class="newAddress-btn">
+      确认转换
+    </button>
+    <p class="submittips">说明:</p>
+    <p class="submittips">1.转账后 请到转账明细 查看明细。</p>
+    <p class="submittips">2.转账将扣除相应金额的佣金,增加转帐金额2倍的代金券。</p>
+    
+  </form>
+</view>

+ 181 - 0
packageUser/pages/user/transfer/transfer.wxss

@@ -0,0 +1,181 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+}
+.newAddress-top {
+  height: 20rpx;
+}
+.newAddress-line {
+  height: 90rpx;
+  line-height: 90rpx;
+  background-color: #fff;
+  font-size: 28rpx;
+  border-bottom: 1px solid #eeeeee;
+  overflow:hidden;
+}
+.bind-wx{
+font-size: 20rpx;
+background: #eab86a;
+color: #FFF;
+padding: 0;
+width: inhert;
+margin: 11px 5px;
+border-radius:15px;
+}
+.getyzm-btn{
+font-size: 24rpx;
+border: 1px solid #eab86a;
+color: #eab86a;
+margin: 5px;
+
+}
+.newAddress-title {
+  float: left;
+  margin-left: 20rpx;
+  color: #4c4c4c;
+  width:80px;
+}
+.text-placeholder {
+  color: #bbbbbb;
+}
+.nameText {
+    width: 50%;
+    height: 90rpx;
+    line-height: 90rpx;
+    color: #4c4c4c;
+    float: right;
+    text-align: left;
+    padding-right: 20rpx;
+    text-align: right;
+}
+.newAddress-picker {
+  float: right;
+  text-align: right;
+  color: #bbbbbb;
+}
+.newAddress-picker__icon {
+  float: right;
+  margin-top: 33rpx;
+  margin-right: 20rpx;
+  margin-left: 12rpx;
+  width: 13rpx;
+  height: 24rpx;
+}
+.newAddress-picker__text {
+  float: right;
+  width: 500rpx;
+}
+.newAddress-more {
+  background-color: #fff;
+}
+.newAddress-more {
+  padding: 30rpx 20rpx;
+}
+.newAddress-more__title {
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.newAddress-form {
+
+}
+.submittips{
+font-size: 24rpx;
+    text-align: center;
+    width: 100%;
+    display: block;
+    padding: 0 20px;
+    padding-top: 20rpx;
+    color: #666;
+    text-align: left;
+}
+.newAddress-btn {
+width: 90%;
+height: 100%;
+background-color: #eab86a;
+color: #fff;
+line-height: 90rpx;
+text-align: center;
+font-size: 28rpx;
+margin: 35px 5% 0 5%;
+border-radius: 45px;
+
+}
+.textarea {
+  padding-top: 20rpx;
+  display: block;
+  width: 710rpx;
+  min-height: 200rpx;
+  line-height: 40rpx;
+  font-size: 28rpx;
+  color: #4c4c4c
+}
+.distpicker {
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    z-index: 999;
+    width: 100%;
+    height: 560rpx;
+    display: flex;
+    justify-content: center;
+    flex-wrap: wrap;
+    background-color: #fff;
+    font-size:28rpx;
+    color:#666;
+}
+.distpicker-btn {
+    display: flex;
+    justify-content: space-between;
+    box-sizing: border-box;
+    width: 100%;
+    padding: 0 40rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+    background-color: #fafafa;
+    color: #eab86a;
+}
+.distpicker-content {
+    box-sizing: border-box;
+    width: 100%;
+    height: 560rpx;
+    background-color: #fff;
+    text-align: center;
+}
+.mask {
+    position: fixed;
+    left: 0;
+    top: 0;
+    z-index: 998;
+    width: 100%;
+    height: 100%;
+    background-color: rgba(0, 0, 0, .4);
+}
+.hidden {
+  display: none;
+}
+.area-item {
+  line-height: 80rpx;
+}
+.newAddress-tip {
+  height: 245rpx;
+  margin-top: 30rpx;
+  background: #ffffff;
+  padding-top: 40rpx;
+  padding-left: 30rpx;
+  padding-right: 20rpx;
+}
+.tip-title {
+  font-size: 33rpx;
+  color: #4e4e4e;
+  padding-bottom: 20rpx;
+}
+.tip-in {
+  font-size: 28rpx;
+  color: #4e4e4e;
+  line-height: 45rpx;
+}
+.tip-color {
+  color: #fe6565;
+}

+ 84 - 0
packageUser/pages/user/transfer/transferList/transferList.js

@@ -0,0 +1,84 @@
+var _request = require('../../../../../utils/request.js')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    price: '',
+    page: 1,
+    per_page: 10,
+    cashList: [],
+    cashList_more: true,
+    cashList_change: false,
+    cashTotal: 0
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getCashTotal()
+    this.getCashList()
+  },
+  onShow () {
+  },
+  onPullDownRefresh: function () {
+    this.setData({
+      page: 1,
+      cashList_more: true,
+      cashList_change: true
+    })
+    this.getCashList()
+    wx.stopPullDownRefresh()
+  },
+  onReachBottom: function () {
+    if (this.data.cashList_more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getCashList()
+    }
+  },
+  getCashTotal () {
+    var that = this
+    var url = 'v1/user/cash/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        cashTotal: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  getCashList () {
+    console.log(this.data.page)
+    var that = this
+    var url = 'v1/user/transfercash/flow'
+    var params = {
+      page: that.data.page,
+      per_page: that.data.per_page
+    }
+    var success = function (res) {
+      if (that.data.cashList_change) {
+        that.setData({
+          cashList: [],
+          cashList_change: false
+        })
+      }
+      var result = that.data.cashList.concat(res.data.balance_list || [])
+      var listMore = res.data.balance_count > result.length
+      that.setData({
+        cashList: result,
+        cashList_more: listMore
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_withdraw'
+    })
+  }
+})

+ 8 - 0
packageUser/pages/user/transfer/transferList/transferList.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "转换列表",
+  "usingComponents": {
+    "currency": "../../../../../component/currency/currency",
+    "format-time": "../../../../../component/formatTime/formatTime"
+  },
+  "enablePullDownRefresh": true
+}

+ 41 - 0
packageUser/pages/user/transfer/transferList/transferList.wxml

@@ -0,0 +1,41 @@
+<view class="withdraw__bg">
+  <view class="withdraw__head">
+    <view class="title">我的余额(元)</view>
+    <view class="price"><currency symbol=" " value="{{cashTotal.available}}" ></currency></view>
+  </view>
+
+  <!-- <view class="withdraw__wid">
+    <view class="withdraw__content">
+      <view class="title">余额充值</view>
+      <view class="withdraw__price">
+        <text>¥</text>
+        <input type="text" placeholder="请输入充值金额" bindinput="rechargePrice" />
+      </view>
+      <view class="withdraw__btn" bindtap="createRecharge">立即充值</view>
+    </view>
+  </view> -->
+  <view class="granary-no" wx:if="{{cashList.length <= 0}}">
+    <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/unorders.png" class="granary-no__icon"></image>
+    <view class="granary-no__text">暂无提现记录</view>
+  </view>
+
+  <view class="withdraw-list" wx:if="{{cashList.length > 0}}">
+
+    <view class="withdraw-info" wx:key="{{index}}" wx:for="{{cashList}}">
+      <view class="withdraw-goods">
+        <view class="name"><!-- 【{{item.source_name}}】{{item.remark}} -->佣金转代金券
+        <view class="money"><currency symbol="-" value="{{item.count}}" ></currency>元</view>
+        </view>
+        <view class="clean"></view>
+      </view>
+      <!-- <view class="price" wx:if="{{item.count > 0}}"><currency symbol="-" value="{{item.count}}" ></currency>元</view>
+      <view class="price green" wx:if="{{item.count < 0}}"><currency symbol="" value="{{item.count}}" ></currency>元</view> -->
+      <view class="price1" wx:if="{{!item.pay_state && (!item.audit_state || item.audit_state === 1)}}">{{item.state_cn}}</view>
+      <view class="price2" wx:if="{{(!item.pay_state && item.audit_state === 2) || (item.pay_state === 2 && item.audit_state === 1)}}">{{item.state_cn}}</view>
+      <view class="price3" wx:if="{{item.pay_state ===1 && item.audit_state === 1}}">{{item.state_cn}}</view>
+      <view class="time"><format-time type="formatTime1" value="{{item.created_at}}" ></format-time></view>
+      <view class="clean"></view>
+    </view>
+  </view>
+
+</view>

+ 105 - 0
packageUser/pages/user/transfer/transferList/transferList.wxss

@@ -0,0 +1,105 @@
+.withdraw__bg {
+  width: 100%;
+  min-height: 100%;
+background: #FFF;
+}
+.withdraw__head {
+  width: 100%;
+  height: 248rpx;
+  background-image: linear-gradient(180deg, 
+    #eab86a 0%, 
+    #d4932b 100%);
+  text-align: center;
+  padding-top: 50rpx;
+  box-sizing: border-box;
+}
+.withdraw__head .title {
+  font-size: 28rpx;
+  color: #ffffff;
+  margin-bottom: 40rpx;
+}
+.withdraw__head .price {
+  font-size: 48rpx;
+  color: #ffffff;
+  font-weight: 600;
+}
+.withdraw-list {
+  width: 100%;
+  padding: 0 20rpx;
+  box-sizing: border-box;
+}
+.withdraw-info {
+  /* height: 160rpx; */
+  padding: 30rpx 0;
+  border-bottom: 1rpx solid #cccccc; 
+  box-sizing: border-box;
+}
+.withdraw-info .time {
+  font-size: 24rpx;
+  color: #bbbbbb;
+  margin-top: 10rpx;
+  float: right;
+}
+.withdraw-goods {
+}
+.withdraw-goods .name {
+  float: left;
+  width: 711rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  display: -webkit-box;
+  text-overflow: ellipsis;
+  -webkit-line-clamp: 2;
+  overflow: hidden;
+  -webkit-box-orient: vertical;
+  line-height: 40rpx;
+  margin-bottom: 22rpx;
+}
+.withdraw-info .money {
+  float: right;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.withdraw-info .price {
+  float: left;
+  width: 250rpx;
+  font-size: 28rpx;
+  color: #eab86a;
+  /* text-align: right; */
+}
+.withdraw-info .price.green {
+  color: #5ebf62;
+}
+.withdraw-info .price1 {
+  float: left;
+  width: 250rpx;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.withdraw-info .price2 {
+  float: left;
+  width: 250rpx;
+  font-size: 28rpx;
+  color: #5ebf62;
+}
+.withdraw-info .price3 {
+  float: left;
+  width: 250rpx;
+  font-size: 28rpx;
+  color: #bbb;
+}
+.granary-no {
+  padding-top: 200rpx;
+}
+.granary-no__icon {
+  display: block;
+  width: 204rpx;
+  height: 258rpx;
+  margin: 0 auto;
+}
+.granary-no__text {
+  text-align: center;
+  font-size: 28rpx;
+  margin-top: 25rpx;
+  color: #cccccc;
+}