Переглянути джерело

Merge branch 'oil' of 39.97.239.116:gyfl/minixyz into oil

stanley-king 4 роки тому
батько
коміт
71e14e7377

+ 0 - 2
README.md

@@ -1,2 +0,0 @@
-# 熊猫美妆小程序
-熊猫美妆小程序

+ 2 - 1
app.js

@@ -17,7 +17,8 @@ App({
         fcodeErr: '',
         backLogin: false,
         arrayTree: [],
-        fromSource: ''
+        fromSource: '',
+        channel: '欧耶商城'
     },
     setFromSource(fromSource) {
         this.globalData.fromSource = fromSource

+ 4 - 3
app.json

@@ -1,10 +1,11 @@
 {
   "pages": [
+    "pages/phoneCharges/phoneCharges",
     "pages/postage/postage",
     "pages/postageManage/postageManage",
+    "pages/index/index",
     "pages/address/address",
     "pages/postageDetail/postageDetail",
-    "pages/index/index",
     "pages/discover/discover",
     "pages/shopCart/shopCart",
     "pages/person/person",
@@ -26,9 +27,9 @@
   ],
   "window": {
     "backgroundTextStyle": "dark",
-    "navigationBarBackgroundColor": "#2B2B2B",
+    "navigationBarBackgroundColor": "#fff",
     "navigationBarTitleText": "椰子充值",
-    "navigationBarTextStyle": "white",
+    "navigationBarTextStyle": "black",
     "onReachBottomDistance": 200
   },
   "tabBar": {

+ 15 - 10
config.js

@@ -1,8 +1,8 @@
 // let api = "https://passport.lrlz.com/mobile/index.php";
 let api = "https://www.xyzshops.cn/mobile/index.php";
 // let api = "http://192.168.1.200/mobile/index.php";
-
-function getReq(data, callback, method) 
+let app = getApp();
+function getReq(data, callback, method)
 {
   let options = {
     client_type: 'mini'
@@ -53,9 +53,9 @@ function getReq(data, callback, method)
   })
 }
 
-function buyVGoods(goods_id,goods_num) 
+function buyVGoods(goods_id,goods_num, other, successCallback, failCallback) 
 {
-  let ifcart = 0
+  let ifcart = 0 ; 
   let cartids = goods_id + '|' + goods_num;
   let params = {
     act: 'member_buy',
@@ -64,7 +64,8 @@ function buyVGoods(goods_id,goods_num)
     usebonus: 0,
     ifcart : 0,
     cart_id: cartids,
-    invoice_id: 0
+    invoice_id: 0,
+    ...other
   }
 
   params = Object.assign({}, params);
@@ -80,14 +81,18 @@ function buyVGoods(goods_id,goods_num)
         signType: param.signType, //微信签名方式:
         paySign: param.paySign,   //微信签名
         success: function (res) {
-          wx.reLaunch({
-            url: "/pages/index/index"
-          })
+          successCallback && successCallback(res)
         },
         fail: function (res) {
-          wx.redirectTo({
-            url: `/pages/orderPaySn/orderPaySn?pay_sn=${pay_sn}`
+          // wx.redirectTo({
+          //   url: `/pages/orderPaySn/orderPaySn?pay_sn=${pay_sn}`
+          // })
+          wx.showToast({
+            icon: 'none',
+            title: '支付失败',
+            duration: 2000
           })
+          failCallback && failCallback(res)
         }
       });
     }

+ 1 - 1
pages/brand/brand.js

@@ -24,7 +24,7 @@ Page({
    */
   onLoad: function (options) {
     wx.setNavigationBarTitle({
-      title: options.title ? options.title : "熊猫美妆"
+      title: options.title ? options.title : app.globalData.channel
     })
     wx.showLoading({
       title: '加载中',

+ 3 - 2
pages/components/blockItem/blockItem.js

@@ -167,9 +167,10 @@ Component({
           
           if(prefix == 'xyzshop://www.xyzshops.com/DirectBuyVGoods') {
             let goods_id = params['goods_id'];
-            let num = params['num'];    
-            buyVGoods(goods_id,num);        
+            let num = params['num'];
+            buyVGoods(goods_id,num);
           }
+          break;
         }
         default: {
           console.log(type + '类型找不到');

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

@@ -1,6 +1,6 @@
 <!--components/blocks/home1/home_one.wxml-->
 <view>
-  <block wx:key="{{item}}" wx:for="{{items}}">
+  <block wx:key="index" wx:for="{{items}}">
       <blockItem special_datas="{{special_datas}}" summery="{{summery}}" item_data="{{item}}"></blockItem>  
   </block>
-</view> 
+</view>

+ 1 - 1
pages/details/details.js

@@ -497,7 +497,7 @@ Page({
     let goods_name = this.data.getOneSummary.goods_mobile_name
     let imageUrl = this.data.imgUrls[0];
     return {
-      title: `熊猫美妆为您推荐:${goods_name}`,
+      title: `${app.globalData.channel}为您推荐:${goods_name}`,
       path: `/pages/details/details?goods_id=${goods_id}`,
       imageUrl: imageUrl
     }

+ 1 - 1
pages/details/details.wxml

@@ -33,7 +33,7 @@
     <view class="f24 col666 l_height34 mt4">库存:{{getOneSummary.goods_storage}}件</view>
     <view class="goods_gap" wx:if="{{getOneSummary['gap_show']}}">
       {{getOneSummary['gap_desc']}}
-      <block wx:if="{{getOneSummary['discount_gap'] > 0}}">前往熊猫美妆APP,享受更多优惠。</block>
+      <block wx:if="{{getOneSummary['discount_gap'] > 0}}">前往{{app.globalData.channel}}APP,享受更多优惠。</block>
     </view>
     <view class="n_goods_title">
       <view class="brand_auth" wx:if="{{getOneSummary.brand_author_desc}}">{{getOneSummary.brand_author_desc}}</view>

+ 1 - 1
pages/index/index.js

@@ -139,7 +139,7 @@ Page({
   },
   onShareAppMessage: function () {
     return {
-      title: "熊猫美妆小程序",
+      title: `${app.globalData.channel}小程序`,
       path: "/pages/index/index"
     }
   },

+ 153 - 0
pages/phoneCharges/phoneCharges.js

@@ -0,0 +1,153 @@
+import recordSource from '../../utils/recordSource';
+const config = require('../../config.js')
+const getReq = config.getReq
+const buyVGoods = config.buyVGoods
+
+let app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    currentIndex: 0,  //页签索引
+    rechargeGearActiveIndex: 0, //挡位项目索引
+    tips:'',  //顶部tips
+    goods:[], //挡位数据
+    goods_id:'', //当前选中挡位的goods_id
+    card_type: '', //油卡类型 (中石化/中石油)
+    card_no: '', //油卡号
+    firstLoad: true,
+    fromSource: ''
+  },
+
+  // 页签切换
+  handlerClickTabItem(e) {
+    var dataset = e.currentTarget.dataset
+    this.setData({
+      currentIndex: dataset.activeindex,
+      card_no: dataset.cardno
+    });
+  },
+
+  //充值档位切换
+  handlerClickRechargeGear(e) {
+    var dataset = e.currentTarget.dataset
+    this.setData({
+      rechargeGearActiveIndex: dataset.activeindex,
+      goods_id: dataset.currentvalue
+    });
+  },
+
+  //跳转到油卡管理页面
+  handlerAddCard(){
+    wx.navigateTo({
+      url: '/pages/postageManage/postageManage',
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    let fromSource = recordSource(app, `act=index&op=card_goods`)
+    this.setData({
+      fromSource: app.globalData.fromSource,
+    });
+    var self = this;
+    getReq({
+      act: 'index',
+      op: 'card_goods',
+      card_type: 'oil',
+      from: fromSource
+    }, function (res) {
+      self.setData({
+        firstLoad: false
+      });
+      if (res.code == 200) {
+        if(res.datas && res.datas.goods){
+          var datas = res.datas
+          self.setData({
+            tips: datas.tips,
+            goods: datas.goods,
+            goods_id: datas.goods[0].goods_id
+          });
+        }
+      }else {
+        wx.showToast({
+          icon: 'none',
+          title: res.message,
+          duration: 2000
+        })
+      }
+    })
+  },
+
+  // 立即充值
+  handlerRecharge(){
+    // wx.showToast({
+    //   icon: 'none',
+    //   title: `goods_id: ${this.data.goods_id}, card_no: ${this.data.card_no}`,
+    //   duration: 2000
+    // })
+    console.table({'goods_id': this.data.goods_id, 'card_no': this.data.card_no})
+
+    buyVGoods(this.data.goods_id,1,{ card_no: this.data.card_no }, (res) => {
+      // console.log('res',res)  成功回调
+    }, (err) => {
+      // 失败回调
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    if(!this.data.firstLoad) {
+      let defaultAddress = app.globalData.defaultAddress
+      console.log('defaultAddress',defaultAddress)
+      app.setFromSource(this.data.fromSource)
+      if (defaultAddress) {
+        this.setData({
+          defaultAddress
+        })
+      }
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  }
+})

+ 5 - 0
pages/phoneCharges/phoneCharges.json

@@ -0,0 +1,5 @@
+{
+  "navigationBarTitleText": "手机充值",
+  "navigationBarBackgroundColor": "#fe7124",
+  "navigationBarTextStyle": "white"
+}

+ 33 - 0
pages/phoneCharges/phoneCharges.wxml

@@ -0,0 +1,33 @@
+<view class="postage">
+  <view class="tips" wx:if="{{tips}}">{{tips}}</view>
+  <!-- 选择油卡 -->
+  <view class="tabs">
+    <view class="tabs-content border-top-radius">
+      <view class="tabs-content__tips">
+        <text class="tabs-content__tips-text">选择手机号(一人最多三个手机号)</text>
+        <!-- <image class="tabs-content__tips-add" src="/image/postage/add.png"></image> -->
+      </view>
+      <view class="card-no vux-1px-b" bindtap="handlerAddCard">
+        13277447251
+      </view>
+    </view>
+  </view>
+  
+  <!-- 充值挡位 -->
+  <view class="rechargeGear" wx:if="{{goods.length}}">
+    <view class="rechargeGear-title">充值挡位</view>
+    <view class="rechargeGear-content">
+      <view class="rechargeGear-content__item {{rechargeGearActiveIndex == index ? 'active' : ''}}" wx:for="{{goods}}" wx:key="index" 
+      bindtap="handlerClickRechargeGear" data-activeindex="{{index}}" data-currentvalue="{{item.goods_id}}">
+        <view class="faceValue">{{item.goods_spec}}</view>
+        <view class="price">售价 {{item.goods_price}} 元</view>
+      </view>
+    </view>
+    <view class="rechargeGear-footer">
+      <view class="btn-rechargeNow" bindtap="handlerRecharge">
+        <text>立即充值</text>
+      </view>
+      <view class="rechargeNow-tips">充值后,即时到账</view>
+    </view>
+  </view>
+</view>

+ 174 - 0
pages/phoneCharges/phoneCharges.wxss

@@ -0,0 +1,174 @@
+.postage{
+  position: relative;
+  padding: 20rpx 0;
+  color: #848799;
+}
+
+.postage::before{
+  content: '';
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 165rpx;
+  background: linear-gradient(to bottom, #fd7428 0%,#fc8f4a 100%);
+  z-index: -1;
+}
+
+.tips{
+  padding: 15rpx 20rpx;
+  width: 92%;
+  margin: 0 auto;
+  background-color: #ffd900;
+  color: #786700;
+  border-radius: 10rpx;
+  box-sizing: border-box;
+  font-size: 26rpx;
+}
+
+.tabs, .rechargeGear{
+  width: 92%;
+  margin: 20rpx auto;
+}
+
+.tabs-title{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  height: 90rpx;
+  line-height: 90rpx;
+  background-color: #fff;
+  border-top-left-radius: 10rpx;
+  border-top-right-radius: 10rpx;
+}
+
+.tabs-title-item{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 50%;
+}
+
+.tabs-title-item__icon{
+  width: 40rpx;
+  height: 40rpx;
+  margin-right: 10rpx;
+}
+
+.tabs-title-item__text{}
+
+.tabs-title-item.active{
+  position: relative;
+  color: #fe7124;
+}
+
+.tabs-title-item.active::before{
+  content: "";
+  position: absolute;
+  bottom: 0;
+  left: 15%;
+  right: 10%;
+  height: 6rpx;
+  background-color: #fe7124;
+}
+
+.tabs-content__tips{
+  display: flex;
+  height: 80rpx;
+  align-items: center;
+}
+
+.tabs-content__tips-text{
+  font-size: 26rpx;  
+}
+
+.tabs-content__tips-add{
+  width: 40rpx;
+  height: 40rpx;
+  margin-left: 50rpx;
+}
+
+.tabs-content,.rechargeGear-footer{
+  padding: 30rpx 30rpx 50rpx 30rpx;
+  background-color: #fff;
+  border-bottom-left-radius: 10rpx;
+  border-bottom-right-radius: 10rpx;
+}
+
+.btn-rechargeNow{
+  width: 85%;
+  padding: 22rpx;
+  margin: 0 auto 30rpx;
+  background-color: #fe7124;
+  background: linear-gradient(to right, #ff7a21 0%,#feb25a 100%);
+  text-align: center;
+  color: #fff;
+  border-radius: 10rpx;
+}
+
+.btn-rechargeNow:active{
+  opacity: .8;
+}
+
+.rechargeNow-tips{
+  text-align: center;
+  font-size: 26rpx;
+}
+
+/* 充值挡位 */
+.rechargeGear-title{
+  height: 84rpx;
+  line-height: 84rpx;
+  background-color: #fff;
+  color: #1e242e;
+  padding-left: 30rpx;
+  border-top-left-radius: 10rpx;
+  border-top-right-radius: 10rpx;
+}
+
+.rechargeGear-content{
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: space-between;
+  background-color: #fff;
+  box-sizing: border-box;
+  padding: 0 30rpx;
+}
+
+.rechargeGear-content__item{
+  width: 30%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  padding: 20rpx 0;
+  border: 1rpx solid #fe7124;
+  border-radius: 10rpx;
+  color: #fe7124;
+  background-color: #fff;
+  margin-bottom: 30rpx;
+}
+
+.rechargeGear-content__item.active{
+  background-color: #fe7124;
+  color: #fff;
+}
+
+.faceValue{
+  margin-bottom: 10rpx;
+}
+
+.price{
+  font-size: 24rpx;
+}
+
+.card-no{
+  padding: 20rpx 0;
+  font-size: 40rpx;
+  color: #2b2b2b;
+}
+
+.border-top-radius{
+  border-top-left-radius: 10rpx;
+  border-top-right-radius: 10rpx;
+}

+ 14 - 79
pages/postage/postage.js

@@ -1,5 +1,7 @@
 import recordSource from '../../utils/recordSource';
-const getReq = require('../../config.js').getReq
+const config = require('../../config.js')
+const getReq = config.getReq
+const buyVGoods = config.buyVGoods
 
 let app = getApp();
 Page({
@@ -17,26 +19,10 @@ Page({
     card_no: '', //油卡号
     firstLoad: true,
     tabsData: [
-      { id: 0, icon: '/image/postage/sinopec.png', title: '中国石化', tips: '选择油卡:(一人最多十张油卡)', card_no: '15853434113521' },
-      { id: 1, icon: '/image/postage/petrochina.png', title: '中国石油', tips: '选择油卡:(一人最多八张油卡)', card_no: '41865461251351' }
+      { id: 0, icon: '/image/postage/sinopec.png', title: '中国石化', tips: '选择油卡(一人最多十张油卡)', card_no: '15853434113521' },
+      { id: 1, icon: '/image/postage/petrochina.png', title: '中国石油', tips: '选择油卡(一人最多八张油卡)', card_no: '41865461251351' }
     ],
-// <<<<<<< HEAD
-//     selectArray: [{
-//         "id": "10",
-//         "text": "9066666888"
-//     }, {
-//         "id": "21",
-//         "text": "25288888556"
-//     }],
-//     gearData: [
-//       { faceValue: 100,  price: 95  },
-//       { faceValue: 200,  price: 190 },
-//       { faceValue: 500,  price: 475 },
-//       { faceValue: 1000, price: 950 }
-//     ]
-// =======
     fromSource: ''
-// >>>>>>> 259bb9c31cb59d1d11de38b7b18920184eefb6c9
   },
 
   // 页签切换
@@ -105,68 +91,17 @@ Page({
 
   // 立即充值
   handlerRecharge(){
-    wx.showToast({
-      icon: 'none',
-      title: `goods_id: ${this.data.goods_id}, card_no: ${this.data.card_no}`,
-      duration: 2000
-    })
+    // wx.showToast({
+    //   icon: 'none',
+    //   title: `goods_id: ${this.data.goods_id}, card_no: ${this.data.card_no}`,
+    //   duration: 2000
+    // })
     console.table({'goods_id': this.data.goods_id, 'card_no': this.data.card_no})
 
-    this.toPay()
-  },
-
-  toPay() {
-    let goods_id = this.data.goods_id
-    let goods_num = 1
-    let iscart = this.data.ifcart
-    let cart_id = this.data.cart_id
-
-    let ifcart = cart_id ? 1 : 0
-    let cartids = cart_id ? cart_id : (goods_id + '|' + goods_num)
-    let params = {
-      act: 'member_buy',
-      op: 'step_vsecond',
-      payment: 'minipay',
-      usebonus: 1,
-      ifcart:1,
-      cart_id: 1,
-      invoice_id: 0
-    }
-    params = Object.assign({}, params);
-    getReq(params, function (res) {
-      wx.hideLoading()
-      if (res.code == 200) {
-        let param = res.datas.param.data
-        let pay_sn = res.datas.pay_sn
-        wx.requestPayment({
-          timeStamp: param.timeStamp, //时间戳,自1970年以来的秒数
-          nonceStr: param.nonceStr, //随机串
-          package: param.package,
-          signType: param.signType, //微信签名方式:
-          paySign: param.paySign, //微信签名
-          success: function (res) {
-            wx.reLaunch({
-              url: "/pages/index/index"
-            })
-          },
-          fail: function (res) {
-            // wx.redirectTo({
-            //   url: `/pages/orderPaySn/orderPaySn?pay_sn=${pay_sn}`
-            // })
-          }
-        });
-      }
-      else {
-        wx.showToast({
-          icon: 'none',
-          title: res.message,
-          duration: 2000
-        })
-        app.globalData.fcodeErr = res.message
-        setTimeout(() => {
-          wx.navigateBack()
-        }, 2000);
-      }
+    buyVGoods(this.data.goods_id,1,{ card_no: this.data.card_no }, (res) => {
+      // console.log('res',res)  成功回调
+    }, (err) => {
+      // 失败回调
     })
   },
 

+ 2 - 1
pages/postage/postage.json

@@ -1,4 +1,5 @@
 {
   "navigationBarTitleText": "油卡充值",
-  "navigationBarBackgroundColor": "#fe7124"
+  "navigationBarBackgroundColor": "#fe7124",
+  "navigationBarTextStyle": "white"
 }

+ 1 - 1
pages/postage/postage.wxml

@@ -10,7 +10,7 @@
       </view>
     </view>
     <view class="tabs-content" wx:for="{{tabsData}}" wx:key="index"  style='display:{{currentIndex !== index ? "none" : "block"}}'>
-      <view class="tabs-content__tips" catchtap="handlerClickAdd">
+      <view class="tabs-content__tips">
         <text class="tabs-content__tips-text">{{item.tips}}</text>
         <!-- <image class="tabs-content__tips-add" src="/image/postage/add.png"></image> -->
       </view>

+ 2 - 1
pages/postageDetail/postageDetail.json

@@ -1,4 +1,5 @@
 {
   "navigationBarTitleText": "添加油卡",
-  "navigationBarBackgroundColor": "#fe7124"
+  "navigationBarBackgroundColor": "#fe7124",
+  "navigationBarTextStyle": "white"
 }

+ 2 - 1
pages/postageManage/postageManage.json

@@ -1,4 +1,5 @@
 {
   "navigationBarTitleText": "油卡管理",
-  "navigationBarBackgroundColor": "#fe7124"
+  "navigationBarBackgroundColor": "#fe7124",
+  "navigationBarTextStyle": "white"
 }

+ 2 - 2
pages/shareBonus/shareBonus.wxml

@@ -96,7 +96,7 @@
       <view class="msg_box pos_rel">
         <view class="name">{{type_info['sender_name']}}</view>
         <view class="msg mt20">该红包已过期。如已领取,</view>
-        <view class="msg">请在熊猫美妆APP中“我的红包”中查看~</view>
+        <view class="msg">请在APP中“我的红包”中查看~</view>
       </view>
     </view>
     <view class="bottom_pro">
@@ -112,7 +112,7 @@
   <view class="grab_container" wx:if="{{bonus_state == 'detail'}}">
     <view class="pos_rel" style="height: 182rpx;">
       <image class="common_bg" src="../../image/bonus/detail_bg.png"></image>
-      <view class="top_title">熊猫美妆红包</view>
+      <view class="top_title">红包</view>
       <image class="sender_head" src="{{sender_head_src}}"></image>
     </view>
     <view class="grab_header">

+ 2 - 2
pages/special/special.js

@@ -19,7 +19,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    let title = options.title ? options.title : "熊猫美妆";
+    let title = options.title ? options.title : app.globalData.channel;
     let special_id = options.special_id;
     wx.setNavigationBarTitle({
       title: title
@@ -104,7 +104,7 @@ Page({
     let special_id = this.data.special_id;
     let title = this.data.title;
     return {
-      title: `熊猫美妆为您推荐:${title}`,
+      title: `${app.globalData.channel}为您推荐:${title}`,
       path: `/pages/special/special?title=${title}&special_id=${special_id}`
     }
   }