Browse Source

番茄h5

yh
杨豪 3 years ago
parent
commit
68153870e6
  1. 35
      App.vue
  2. 6
      common/config.js
  3. 2
      common/httpRequest.js
  4. 95
      common/jweixin.js
  5. 18
      manifest.json
  6. 6
      pages/index/index.vue
  7. 2
      pages/index/selectCampus.vue
  8. 14
      pages/index/tasksdetails.vue
  9. 28
      pages/my/myVIP.vue
  10. 4
      pages/order/release.vue
  11. 3
      pages/public/login.vue
  12. 2
      pagesB/pages/my/myVIP.vue
  13. 4
      project.config.json

35
App.vue

@ -6,13 +6,13 @@
onLaunch: function() { onLaunch: function() {
let that = this; let that = this;
// //
that.$Request.getT('/common/type/88').then(res => { // that.$Request.getT('/common/type/88').then(res => {
if (res.code == 0) { // if (res.code == 0) {
if (res.data && res.data.value) { // if (res.data && res.data.value) {
this.$queue.setData('publicRelation', res.data.value); // this.$queue.setData('publicRelation', res.data.value);
} // }
} // }
}); // });
// //
that.$Request.getT('/common/type/86').then(res => { that.$Request.getT('/common/type/86').then(res => {
if (res.code == 0) { if (res.code == 0) {
@ -22,13 +22,13 @@
} }
}); });
// //
that.$Request.getT('/common/type/170').then(res => { // that.$Request.getT('/common/type/170').then(res => {
if (res.code == 0) { // if (res.code == 0) {
if (res.data && res.data.value) { // if (res.data && res.data.value) {
this.$queue.setData('fensiImage', res.data.value); // this.$queue.setData('fensiImage', res.data.value);
} // }
} // }
}); // });
// //
that.$Request.getT('/common/type/168').then(res => { that.$Request.getT('/common/type/168').then(res => {
if (res.code == 0) { if (res.code == 0) {
@ -55,7 +55,11 @@
}); });
}, },
onShow: function() { onShow: function(e) {
if(e && e.query.code){ //h5code
let code = e.query.code
this.$queue.setData('wxCode', code);
}
}, },
onHide: function() {} onHide: function() {}
}; };
@ -68,4 +72,5 @@
view{ view{
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>

6
common/config.js

@ -1,6 +1,8 @@
// const ROOTPATH1 = "http://192.168.0.111:8891/sqx_fast"; // const ROOTPATH1 = "http://10.11.32.109:8891/sqx_fast";
const ROOTPATH1 = "https://fanqie.app.cyjyyjy.com/sqx_fast"; // const ROOTPATH1 = "http://10.11.32.107:8891/sqx_fast";
const ROOTPATH1 = "http://waimai.n.gznl.top/sqx_fast";
// const ROOTPATH1 = "https://fanqie.app.cyjyyjy.com/sqx_fast";
const ROOTPATH = "https://bwc.xianmxkj.com/sqx_fast"; const ROOTPATH = "https://bwc.xianmxkj.com/sqx_fast";
module.exports = { module.exports = {
APIHOST: ROOTPATH, APIHOST: ROOTPATH,

2
common/httpRequest.js

@ -59,7 +59,7 @@ module.exports = {
"token": token "token": token
}, },
success: function (result) { success: function (result) {
console.error(result); // console.error(result);
succ.call(self, result.data) succ.call(self, result.data)
}, },
fail: function (e) { fail: function (e) {

95
common/jweixin.js

@ -1,4 +1,7 @@
var jweixin = require('jweixin-module') var jweixin = require('jweixin-module')
const userId = uni.getStorageSync('userId');
console.log(userId,'userId')
import HttpRequest from '../common/httpRequest'
export default { export default {
//判断是否在微信中 //判断是否在微信中
isWechat: function () { isWechat: function () {
@ -13,17 +16,8 @@ export default {
}, },
//初始化sdk配置 //初始化sdk配置
initJssdkShare: function (callback, url) { initJssdkShare: function (callback, url) {
uni.request({ HttpRequest.getT('/appLogin/jsapiInit',{url: url}).then((result)=>{
url: 'http://licai.youma.me/index/wechat/', if(result.code == 0){
method: 'GET',
data: {
url: 'http://licaifrot.youma.me/'
}, //这里不是统一的,看你们后端
success: (res) => {
console.log(res)
if (res.statusCode == 200) {
let result = res.data.Data
console.log(result)
jweixin.config({ jweixin.config({
debug: false, debug: false,
appId: result.appId, appId: result.appId,
@ -34,19 +28,16 @@ export default {
'chooseWXPay', 'chooseWXPay',
'checkJsApi', 'checkJsApi',
'updateTimelineShareData', 'updateTimelineShareData',
'updateAppMessageShareData' 'updateAppMessageShareData',
'getLocation'
] ]
}); });
//配置完成后,再执行分享等功能
if (callback) { if (callback) {
callback(result); callback(result);
} }
} }
} })
});
}, },
//在需要自定义分享的页面中调用
share: function (data, url) { share: function (data, url) {
url = url ? url : window.location.href; url = url ? url : window.location.href;
console.log("url:" + url) console.log("url:" + url)
@ -75,8 +66,74 @@ export default {
//分享到朋友圈接口 //分享到朋友圈接口
// jweixin.updateTimelineShareData(shareData); // jweixin.updateTimelineShareData(shareData);
}); });
}, url); }, url)
}, },
wxChatWebPay: function (url) {
if (!this.isWechat()) {
uni.showToast({
title: '不在微信客户端',
icon: 'none'
})
return;
}
return new Promise((resolve,reject)=>{
//每次都需要重新初始化配置
this.initJssdkShare(function () {
jweixin.ready(function () {
HttpRequest.postT('/api/order/wxPayMember?userId=' + userId + '&type=3').then((orderInfo)=>{
jweixin.chooseWXPay({
nonceStr: orderInfo.noncestr,
timestamp: orderInfo.timestamp,
package: orderInfo.package,
signType: orderInfo.signType,
paySign: orderInfo.sign,
success: (res) => {
console.log('支付成功')
resolve(res)
},
fail: (res)=> {
reject(res)
console.log('支付失败')
},
cancel: (res)=> {
resolve(res)
console.log('取消支付')
}
})
})
});
},url)
})
},
wxGetLocation: function(url){
return new Promise((resolve,reject)=>{
if (!this.isWechat()) {
uni.showModal({
title: '提示!',
content: '请在微信客户端内打开',
showCancel: false
})
uni.hideLoading()
return
reject(res)
}
//每次都需要重新初始化配置
this.initJssdkShare(function () {
jweixin.ready(function () {
jweixin.getLocation({
type: 'wgs84',
success: function (res) {
console.log('jssdk获取的位置:',res.longitude,res.latitude)
resolve(res)
},
cancel: function (res) {
reject(res)
alert('您已禁止获取位置信息')
}
});
});
},url)
})
}
} }

18
manifest.json

@ -25,7 +25,6 @@
"autoclose" : true, "autoclose" : true,
"delay" : 0 "delay" : 0
}, },
/* */
"modules" : { "modules" : {
"Payment" : {}, "Payment" : {},
"Share" : {}, "Share" : {},
@ -63,9 +62,7 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
/* ios */
"ios" : {}, "ios" : {},
/* SDK */
"sdkConfigs" : { "sdkConfigs" : {
"payment" : { "payment" : {
"weixin" : { "weixin" : {
@ -131,9 +128,7 @@
} }
} }
}, },
/* */
"quickapp" : {}, "quickapp" : {},
/* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wx5f5b49c361569a10", "appid" : "wx5f5b49c361569a10",
"setting" : { "setting" : {
@ -168,7 +163,7 @@
}, },
"h5" : { "h5" : {
"title" : "番茄饭团用户端", "title" : "番茄饭团用户端",
"domain" : "https://fanqie.h5.cyjyyjy.com", "domain" : "https://user.fanqiefantuan.com",
"sdkConfigs" : { "sdkConfigs" : {
"maps" : { "maps" : {
"qqmap" : { "qqmap" : {
@ -177,10 +172,17 @@
} }
}, },
"router" : { "router" : {
"base" : "/waimai_h5/" "base" : "",
"mode" : "history"
}, },
"devServer" : { "devServer" : {
"https" : false "https" : false,
"disableHostCheck" : true
},
"optimization" : {
"treeShaking" : {
"enable" : true
}
} }
} }
} }

6
pages/index/index.vue

@ -623,7 +623,6 @@
type: 'gcj02', type: 'gcj02',
altitude: true, altitude: true,
success: res => { success: res => {
console.log(res, 'aaaa')
// #ifdef H5 // #ifdef H5
that.loAcquire(res.longitude,res.latitude) that.loAcquire(res.longitude,res.latitude)
// #endif // #endif
@ -675,7 +674,6 @@
this.banners.push(d); this.banners.push(d);
} }
}); });
console.log(this.banners)
} }
}); });
}, },
@ -887,13 +885,13 @@
width: 100%; width: 100%;
// overflow: hidden; // overflow: hidden;
background-color: #F6F6F6; background-color: #F6F6F6;
} }
.home-bgi { .home-bgi {
width: 100%; width: 100%;
height: 260rpx; height: 260rpx;
background: #FFF; background: #FFF;
.swiper { .swiper {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -930,7 +928,7 @@
.nav { .nav {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 32rpx; padding: 20rpx 32rpx 0;
} }
.nav .citys { .nav .citys {

2
pages/index/selectCampus.vue

@ -80,7 +80,7 @@
}, },
methods: { methods: {
gocity() { gocity() {
const key = 'YXDBZ-P5LWW-375RH-OCVNQ-B2HY7-U6FBG'; // 使key const key = 'ILKBZ-MOUWU-4Z6VM-22BLP-CUDXQ-I4F5L'; // 使key
const referer = '番茄饭团霸王餐'; // app const referer = '番茄饭团霸王餐'; // app
const hotCitys = ''; // const hotCitys = ''; //
wx.navigateTo({ wx.navigateTo({

14
pages/index/tasksdetails.vue

@ -541,10 +541,14 @@
this.$queue.showLoading('抢单中...'); this.$queue.showLoading('抢单中...');
let userId = this.$queue.getData('userId'); let userId = this.$queue.getData('userId');
this.$Request.postT('/wm/insertOrders?goodsId=' + this.goodsId + '&userId=' + userId).then(res => { this.$Request.postT('/wm/insertOrders?goodsId=' + this.goodsId + '&userId=' + userId).then(res => {
console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.$queue.showToast('抢单成功!'); // this.$queue.showToast('');
this.initHelpOrder(this.goodsId); uni.showToast({
title: '抢单成功!'
})
setTimeout(d => { setTimeout(d => {
this.initHelpOrder(this.goodsId);
if (this.info.classify == 2) { // if (this.info.classify == 2) { //
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
@ -556,7 +560,7 @@
}) })
// #endif // #endif
//#ifdef H5 //#ifdef H5
window.location.href = this.info.url; // window.location.href = this.info.url;
//#endif //#endif
} else if (this.info.classify == 1) { //饿 } else if (this.info.classify == 1) { //饿
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -569,10 +573,10 @@
}) })
// #endif // #endif
//#ifdef H5 //#ifdef H5
window.location.href = this.info.url; // window.location.href = this.info.url;
//#endif //#endif
} }
}, 500); }, 1500);
} else { } else {
uni.hideLoading(); uni.hideLoading();
this.$queue.showToast(res.msg); this.$queue.showToast(res.msg);

28
pages/my/myVIP.vue

@ -56,6 +56,7 @@ color: #FFFFFF;">元</view>
</template> </template>
<script> <script>
import jweixin from '@/common/jweixin.js'
export default { export default {
data() { data() {
return { return {
@ -139,7 +140,21 @@ color: #FFFFFF;">元</view>
uni.showLoading({ uni.showLoading({
title: '支付中' title: '支付中'
}); });
this.$Request.postT('/api/order/wxPayMember?userId=' + userId).then(res => { //#ifdef MP-WEIXIN
this.$Request.postT('/api/order/wxPayMember?userId=' + userId + '&type=3').then(res => {
this.wxPay(res)
uni.hideLoading();
})
//#endif
//#ifdef H5
this.h5Pay()
//#endif
} else {
uni.hideLoading();
this.goLogin();
}
},
wxPay(res){
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp: res.timestamp, timeStamp: res.timestamp,
@ -161,10 +176,12 @@ color: #FFFFFF;">元</view>
that.$queue.showToast('支付失败'); that.$queue.showToast('支付失败');
} }
}); });
},
h5Pay(){
var pageUrl = encodeURIComponent(window.location.href);
jweixin.wxChatWebPay(pageUrl).then((result)=>{
uni.hideLoading();
}) })
} else {
this.goLogin();
}
}, },
} }
} }
@ -174,6 +191,9 @@ color: #FFFFFF;">元</view>
page { page {
width: 100%; width: 100%;
background-color: #FFFFFF; background-color: #FFFFFF;
/* #ifdef H5 */
padding-top: 20rpx;
/* #endif */
} }
.top-box{ .top-box{
padding: 0 32rpx; padding: 0 32rpx;

4
pages/order/release.vue

@ -50,8 +50,8 @@
phone: '', phone: '',
money: "", money: "",
imageList: [], imageList: [],
imageList1: ['https://h5.canmoujiang.com/img/20210531/dceedf8061294b1d99043ca78ff57090.png', imageList1: ['https://download.cyjyyjy.com/e3975ab59055a9e453563ff9f3c6356.jpg',
'https://h5.canmoujiang.com/img/20210531/3ff0fa04f1cb4debb6ec017293bf6c6f.jpg' 'https://download.cyjyyjy.com/f0ca8f2c95df8a516da37d83d90314d.jpg'
], ],
orderId: '', //ID orderId: '', //ID
value1: 0, value1: 0,

3
pages/public/login.vue

@ -294,6 +294,8 @@
toLogin() { toLogin() {
this.$queue.loginClear(); this.$queue.loginClear();
let openid = this.$queue.getData('openid'); let openid = this.$queue.getData('openid');
const wxCode = this.$queue.getData('wxCode');
console.log(wxCode)
const { const {
mobilePhone, mobilePhone,
code, code,
@ -315,6 +317,7 @@
this.$Request this.$Request
.postJson('/appLogin/loginByPhone', { .postJson('/appLogin/loginByPhone', {
code: code, code: code,
wxCode: wxCode,
mobile: mobilePhone mobile: mobilePhone
}) })
.then(res => { .then(res => {

2
pagesB/pages/my/myVIP.vue

@ -180,7 +180,7 @@ color: #FFFFFF;">元</view>
uni.showLoading({ uni.showLoading({
title: '支付中' title: '支付中'
}); });
this.$Request.postT('/api/order/wxPayMember?userId=' + userId).then(res => { this.$Request.postT('/api/order/wxPayMember?userId=' + userId + '&type=3').then(res => {
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp: res.timestamp, timeStamp: res.timestamp,

4
project.config.json

@ -30,12 +30,8 @@
"enableEngineNative": false, "enableEngineNative": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
<<<<<<< HEAD
"showES6CompileOption": false
=======
"showES6CompileOption": false, "showES6CompileOption": false,
"minifyWXML": true "minifyWXML": true
>>>>>>> 661ea8f1c91af482df1a982bf8c644694bee7897
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.20.1", "libVersion": "2.20.1",

Loading…
Cancel
Save