vip价格从配置中获取
This commit is contained in:
parent
01c7825aaa
commit
e69aa2ff5a
@ -29,13 +29,13 @@
|
|||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"current": 1,
|
"current": 0,
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"name": "product_page",
|
"name": "product_page",
|
||||||
"pathName": "pages/product",
|
"pathName": "pages/product",
|
||||||
"query": "gid=7002058&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNmUxYjk3NDA5MGY5NTYxM2M3YjgxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDNfb0pZYXA1WlZSV0RGRm9Qd09GcGllQmVNRkVocyIsInNlc3Npb25faWQiOiIxNTUwNzU0Njg5XzE1NTA3MTc1OTRfYjA5YTVmOWYxODM0NDFmOWUxMDk1MGJmOTUyZTRjMjFfNTcyOWRkOWYyMzQ5NzdlM2IwMGNjOGFjYWRjMjFiOTQiLCJpYXQiOjE1NTA3NTQ2ODl9.GkUGGb2vwTE1xgZ-UKwl6Tfs3NFawE2V3ZAH91_syY4",
|
"query": "gid=7002058&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjN2Y1NWIyYzQ0NzVmMWMzMDg4YjcxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDRfbzVGclg1WG45eHM4d1pmdHlSYVd4ZEVuQ2FyMCIsInNlc3Npb25faWQiOiIxNTUxODQ4ODgxXzE1NTE4NDg0NjVfNmFhZjNlMTQzNWMxNDNiODdkYzI0MWU2ZTQ0MGYwMmFfNjgxYzhiYWUxZGI0ODFiMDdkYmQxNzJjYmMwNDVlYWQiLCJpYXQiOjE1NTE4NDg4ODJ9.kdTs8UIGP9sxdZN7cpO047bBg69SBUQn6BMZ0Ndckgg",
|
||||||
"scene": null
|
"scene": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,20 +1,7 @@
|
|||||||
var jcfw = require('./jcfw');
|
var jcfw = require('./jcfw');
|
||||||
var jcgamelog = jcfw.gamelog;
|
var jcgamelog = jcfw.gamelog;
|
||||||
var jcshare = jcfw.share;
|
var jcshare = jcfw.share;
|
||||||
var ShareConfig = {
|
|
||||||
'money':
|
|
||||||
{
|
|
||||||
urls: ['gift.jpg'],
|
|
||||||
titles: ['领元宝'],
|
|
||||||
logid: 1
|
|
||||||
},
|
|
||||||
'normal':
|
|
||||||
{
|
|
||||||
urls: ['gift.jpg'],
|
|
||||||
titles: ['领元宝'],
|
|
||||||
logid: 2
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var SDKManage = function() {
|
var SDKManage = function() {
|
||||||
this.isoffical = false;
|
this.isoffical = false;
|
||||||
this.gameId = 8003;
|
this.gameId = 8003;
|
||||||
@ -101,13 +88,7 @@ var SDKManage = function() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var cbs = function(res) {
|
var cbs = function(res) {
|
||||||
self.doLogin();
|
self.doLogin();
|
||||||
for (var i = 0; i < res.length; i++) {
|
|
||||||
var sdt = res[i];
|
|
||||||
if (ShareConfig[sdt.type]) {
|
|
||||||
ShareConfig[sdt.type].urls = sdt.images;
|
|
||||||
ShareConfig[sdt.type].titles = sdt.strs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if(cc.sys.platform == cc.sys.WECHAT_GAME){
|
// if(cc.sys.platform == cc.sys.WECHAT_GAME){
|
||||||
// wx.showShareMenu({
|
// wx.showShareMenu({
|
||||||
// withShareTicket: false
|
// withShareTicket: false
|
||||||
|
17
src/mixins/cfg.js
Normal file
17
src/mixins/cfg.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import wepy from 'wepy'
|
||||||
|
|
||||||
|
export default class cfgMixin extends wepy.mixin {
|
||||||
|
$getPrice(name) {
|
||||||
|
let cfgObj = wepy.getStorageSync('cfg');
|
||||||
|
let price = cfgObj.ext_json_cfg;
|
||||||
|
let obj = {"product_price": 50, "vip_price": 5000, "vip_discount": 3000, "month_price": 1500, "month_discount": 1000};
|
||||||
|
if (price) {
|
||||||
|
try {
|
||||||
|
obj = JSON.parse(price);
|
||||||
|
} catch (err) {
|
||||||
|
console.log('parse json error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj[name];
|
||||||
|
}
|
||||||
|
}
|
@ -17,15 +17,24 @@
|
|||||||
border-right: 1rpx solid #e5e5e5;
|
border-right: 1rpx solid #e5e5e5;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position:relative;
|
position:relative;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
.price-txt {
|
.price-txt {
|
||||||
position: absolute;
|
width: 50%;
|
||||||
top: 50%;
|
display: flex;
|
||||||
left: 50%;
|
justify-content: center;
|
||||||
transform: translate(-50%, -50%);
|
align-items: center;
|
||||||
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.product-name {
|
.product-name {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.delete-txt{
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
.red-txt {
|
||||||
|
color: #ee3333;
|
||||||
}
|
}
|
||||||
.selected {
|
.selected {
|
||||||
border: 4rpx solid #f85;
|
border: 4rpx solid #f85;
|
||||||
@ -39,11 +48,17 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<image class="product_img" mode="widthFix" src="https://resource.kingsome.cn/voodoo/5c789e6e486f49165aa057b8.jpeg"/>
|
<image class="product_img" mode="widthFix" src="https://resource.kingsome.cn/voodoo/5c789e6e486f49165aa057b8.jpeg"/>
|
||||||
<view class="one-product {{currentType === 'vip'? 'selected' : ''}}" @tap="selectType('vip')">
|
<view class="one-product {{currentType === 'vip'? 'selected' : ''}}" @tap="selectType('vip')">
|
||||||
<view class="price"><view class="price-txt">30元</view></view>
|
<view class="price">
|
||||||
|
<view class="price-txt delete-txt"> 原价{{vip_price/100}}元 </view>
|
||||||
|
<view class="price-txt red-txt">折扣价{{vip_discount/100}}元</view>
|
||||||
|
</view>
|
||||||
<view class="product-name">终身</view>
|
<view class="product-name">终身</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="one-product {{currentType === 'vip_month'? 'selected' : ''}}" @tap="selectType('vip_month')">
|
<view class="one-product {{currentType === 'vip_month'? 'selected' : ''}}" @tap="selectType('vip_month')">
|
||||||
<view class="price"><view class="price-txt">10元</view></view>
|
<view class="price">
|
||||||
|
<view class="price-txt delete-txt"> 原价{{month_price/100}}元 </view>
|
||||||
|
<view class="price-txt red-txt">折扣价{{month_discount/100}}元</view>
|
||||||
|
</view>
|
||||||
<view class="product-name">一个月</view>
|
<view class="product-name">一个月</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -56,8 +71,10 @@
|
|||||||
import http from '../utils/http';
|
import http from '../utils/http';
|
||||||
import jcEvent from '../common/jc-event';
|
import jcEvent from '../common/jc-event';
|
||||||
import gameBottomBar from '../components/game-bottom-bar';
|
import gameBottomBar from '../components/game-bottom-bar';
|
||||||
|
import cfg from '../mixins/cfg';
|
||||||
|
|
||||||
export default class BuyVipPage extends wepy.page {
|
export default class BuyVipPage extends wepy.page {
|
||||||
|
mixins = [cfg];
|
||||||
config = {
|
config = {
|
||||||
navigationBarTitleText: '购买VIP'
|
navigationBarTitleText: '购买VIP'
|
||||||
};
|
};
|
||||||
@ -74,7 +91,12 @@
|
|||||||
secondBtnTitle: '取消'
|
secondBtnTitle: '取消'
|
||||||
},
|
},
|
||||||
tid: '',
|
tid: '',
|
||||||
currentType: 'vip'
|
currentType: 'vip',
|
||||||
|
vip_price: 5000,
|
||||||
|
vip_discount: 3000,
|
||||||
|
month_price: 1500,
|
||||||
|
month_discount: 1000
|
||||||
|
|
||||||
};
|
};
|
||||||
methods = {
|
methods = {
|
||||||
selectType(type) {
|
selectType(type) {
|
||||||
@ -100,6 +122,13 @@
|
|||||||
onLoad(params) {
|
onLoad(params) {
|
||||||
this.gid = decodeURIComponent(params.gid);
|
this.gid = decodeURIComponent(params.gid);
|
||||||
}
|
}
|
||||||
|
onShow() {
|
||||||
|
this.vip_price = this.$getPrice('vip_price');
|
||||||
|
this.vip_discount = this.$getPrice('vip_discount');
|
||||||
|
this.month_price = this.$getPrice('month_price');
|
||||||
|
this.month_discount = this.$getPrice('month_discount');
|
||||||
|
this.$apply();
|
||||||
|
}
|
||||||
buy(type) {
|
buy(type) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let account = wepy.getStorageSync('account');
|
let account = wepy.getStorageSync('account');
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
import addressFrom from '../components/address-form';
|
import addressFrom from '../components/address-form';
|
||||||
import http from '../utils/http';
|
import http from '../utils/http';
|
||||||
import jcEvent from '../common/jc-event';
|
import jcEvent from '../common/jc-event';
|
||||||
|
import cfg from '../mixins/cfg';
|
||||||
|
|
||||||
export default class ProductPage extends wepy.page {
|
export default class ProductPage extends wepy.page {
|
||||||
|
mixins = [cfg];
|
||||||
components = {
|
components = {
|
||||||
gameBottomBar: gameBottomBar,
|
gameBottomBar: gameBottomBar,
|
||||||
addressFrom: addressFrom
|
addressFrom: addressFrom
|
||||||
@ -48,7 +50,8 @@
|
|||||||
methods = {
|
methods = {
|
||||||
bottomMainTap(e) {
|
bottomMainTap(e) {
|
||||||
console.log('bottomMainTap');
|
console.log('bottomMainTap');
|
||||||
this.showBuyMenu();
|
// this.showBuyMenu();
|
||||||
|
this.buy();
|
||||||
},
|
},
|
||||||
bottomSecondTap(e) {
|
bottomSecondTap(e) {
|
||||||
console.log('bottomSecondTap');
|
console.log('bottomSecondTap');
|
||||||
@ -66,7 +69,7 @@
|
|||||||
await this.updateUserInfo();
|
await this.updateUserInfo();
|
||||||
this.buy();
|
this.buy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user