|
@@ -22,6 +22,7 @@ Page({
|
|
|
isCloseluxiang:false,
|
|
|
|
|
|
uiShowModelView:false,
|
|
|
+ UiShowModel_Bottom:false,
|
|
|
uiMainView:true,
|
|
|
uiShowNum:3,
|
|
|
uiShowIndex:0,
|
|
@@ -40,11 +41,58 @@ Page({
|
|
|
'http://img04.sogoucdn.com/app/a/100520093/ca86e620b9e623ff-d72d635343d5bade-dcf2acda7a45cb44f172db138bdf8d2d.jpg',
|
|
|
],
|
|
|
listShowModelDes:[
|
|
|
- {ModelName:'禺强',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(禺强)',ModelPrice:'¥1.99'},
|
|
|
- {ModelName:'AAA',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(AAA)',ModelPrice:'¥2.99'},
|
|
|
- {ModelName:'BBB',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(BBB)',ModelPrice:'¥3.99'},
|
|
|
+ {ModelName:'禺强',ModelIntroduce2:'天降祥瑞,尾挂龙鳞', ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(禺强)',ModelPrice:'¥1.99',ModelUnlock:false},
|
|
|
+ {ModelName:'AAA',ModelIntroduce2:'天降祥瑞,尾挂龙鳞',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(AAA)',ModelPrice:'¥2.99',ModelUnlock:false},
|
|
|
+ {ModelName:'BBB',ModelIntroduce2:'天降祥瑞,尾挂龙鳞',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(BBB)',ModelPrice:'¥3.99',ModelUnlock:false},
|
|
|
],
|
|
|
+ current:0,
|
|
|
+ products:[],
|
|
|
+ modelImg:[
|
|
|
+ 'https://wx-model-1317557471.cos.ap-shanghai.myqcloud.com/WXImage/%E9%80%89%E6%8B%A9%E7%A5%9E%E5%85%BD-%E9%B8%BE%E9%B8%9F%E9%A2%84%E8%A7%88%E5%9B%BE.png',
|
|
|
+ 'https://wx-model-1317557471.cos.ap-shanghai.myqcloud.com/WXImage/%E9%80%89%E6%8B%A9%E7%A5%9E%E5%85%BD-%E5%BA%94%E9%BE%99%E9%A2%84%E8%A7%88%E5%9B%BE.png',
|
|
|
+ 'https://wx-model-1317557471.cos.ap-shanghai.myqcloud.com/WXImage/%E9%80%89%E6%8B%A9%E7%A5%9E%E5%85%BD-%E5%A4%AB%E8%AF%B8%E9%A2%84%E8%A7%88%E5%9B%BE.png',
|
|
|
+ 'https://wx-model-1317557471.cos.ap-shanghai.myqcloud.com/WXImage/%E9%80%89%E6%8B%A9%E7%A5%9E%E5%85%BD-%E7%8B%BB%E7%8C%8A%E9%A2%84%E8%A7%88%E5%9B%BE.png',
|
|
|
+ ],
|
|
|
+ log:"123",
|
|
|
+ },
|
|
|
+ onLoad(){
|
|
|
+
|
|
|
+ },
|
|
|
+ onShow(){
|
|
|
+ this.setData({log:'OnShow'});
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: 'https://api-fat1.ghz-tech.com/miniprogram-shanhaijing/v1/product/listInfo',
|
|
|
+ method:'POST',
|
|
|
+ header:{
|
|
|
+ 'Content-Type':'application/json'
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ topic:1
|
|
|
+ },
|
|
|
+ success:(res)=>{
|
|
|
+ console.log('POST 请求成功', res.data);
|
|
|
+ that.setData({log:'POST 请求成功'});
|
|
|
+ var products2 = res.data.data.products;
|
|
|
+ var modelImgs = this.data.modelImg;
|
|
|
+ console.log(' 商品列表 ',products2[0].desc);
|
|
|
+
|
|
|
+ for(var i =0;i<products2.length;i++){
|
|
|
+ products2[i]["modelImg"] = modelImgs[i];
|
|
|
+ }
|
|
|
+ that.setData({products:products2});
|
|
|
+ console.log(' 商品列表 ',this.data.products[0]);
|
|
|
+ that.setData({UiShowModel_Bottom:true});
|
|
|
+
|
|
|
+ },
|
|
|
+ fail:function(err){
|
|
|
+ console.error('POST 请求失败', err);
|
|
|
+ var errorlog = err.toString();
|
|
|
+ that.setData({log:errorlog});
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
handleReady: function({detail}) {
|
|
|
this.setData({
|
|
|
sceneWidth: detail.width,
|
|
@@ -176,8 +224,18 @@ Page({
|
|
|
},
|
|
|
clickCloseUIShow(e){
|
|
|
this.setData({uiMainView:true});
|
|
|
+ this.setData({zhaohuanstate:true});
|
|
|
this.setData({uiShowModelView:false});
|
|
|
},
|
|
|
+ clickJiSuoModel(e){
|
|
|
+
|
|
|
+ },
|
|
|
+ changeMoel:function(event){
|
|
|
+ var current2 = event.detail.current;
|
|
|
+ this.setData({
|
|
|
+ current:current2
|
|
|
+ })
|
|
|
+ },
|
|
|
clickShowLeft(e){
|
|
|
|
|
|
var leftoldIndex = this.data.uiShowNum;
|
|
@@ -196,12 +254,81 @@ Page({
|
|
|
this.setData({uiShowIndex:0});
|
|
|
break;
|
|
|
}
|
|
|
+ let current = this.data.current;
|
|
|
+ current = current > 0 ? current - 1 : 0;
|
|
|
+ this.setData({
|
|
|
+ current: current,
|
|
|
+ });
|
|
|
},
|
|
|
clickShowRight(e){
|
|
|
var oldIndex = this.data.uiShowIndex;
|
|
|
oldIndex = oldIndex+1;
|
|
|
var nIndex = oldIndex%3;
|
|
|
this.setData({uiShowIndex:nIndex});
|
|
|
+
|
|
|
+ let current = this.data.current;
|
|
|
+ current = current < 2 ? current + 1 : 2;
|
|
|
+ this.setData({
|
|
|
+ current: current,
|
|
|
+ });
|
|
|
+
|
|
|
+ },clickJiSuoModel(e){
|
|
|
+ var that = this;
|
|
|
+ wx.login({
|
|
|
+ success: (res) => {
|
|
|
+ if (res.code) {
|
|
|
+
|
|
|
+ console.log('用户登录成功,code:', res.code);
|
|
|
+ var modelId = this.data.products[this.data.current].id;
|
|
|
+ console.log('当前ModelId ', modelId);
|
|
|
+ wx.request({
|
|
|
+ url: 'https://api-fat1.ghz-tech.com/miniprogram-shanhaijing/v1/order/prepay',
|
|
|
+ method:'POST',
|
|
|
+ header:{
|
|
|
+ 'Content-Type':'application/json'
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ shop_cart:[{
|
|
|
+ id:modelId,
|
|
|
+ count:1
|
|
|
+ }],
|
|
|
+ js_code:res.code
|
|
|
+ },
|
|
|
+ success:function(res){
|
|
|
+ console.log('POST 请求成功', res.data.data);
|
|
|
+ var paySignStr = res.data.data.pay_Sign;
|
|
|
+ console.log('即将调取微信支付',res.data.data.pay_Sign);
|
|
|
+
|
|
|
+ wx.requestPayment({
|
|
|
+ nonceStr: res.data.data.nonce_str,
|
|
|
+ package: res.data.data.package,
|
|
|
+ paySign: res.data.data.pay_sign,
|
|
|
+ timeStamp: res.data.data.time_stamp,
|
|
|
+ signType:res.data.data.sign_type,
|
|
|
+ success(res){
|
|
|
+ console.log( '微信支付请求成功',res );
|
|
|
+
|
|
|
+
|
|
|
+ var products2 = that.data.products;
|
|
|
+ products2[that.data.current].activate = true;
|
|
|
+ that.setData({products:products2});
|
|
|
+ console.log('AAAA ',that.data.products);
|
|
|
+
|
|
|
+ },
|
|
|
+ fail(err){
|
|
|
+ console.log('微信支付请求失败',err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail:function(err){
|
|
|
+ console.error('POST 请求失败', err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('登录失败!' + res.errMsg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
});
|