fix: 点餐修改

This commit is contained in:
whitechiina 2025-08-28 13:17:40 +08:00
parent 6677401d43
commit caec57ea4a
23 changed files with 195 additions and 113 deletions

BIN
.DS_Store vendored

Binary file not shown.

3
config/app.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
HTTP_REQUEST_URL: 'https://tpoint.agrimedia.cn',
}

View File

@ -5,6 +5,7 @@
"versionName" : "1.0.1",
"versionCode" : "100",
"transformPx" : false,
"sassImplementationName" : "node-sass",
/* 5+App */
"app-plus" : {
"usingComponents" : true,

View File

@ -205,6 +205,7 @@
</template>
<script>
import { HTTP_REQUEST_URL } from '@/config/app.js';
//
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
@ -446,7 +447,8 @@
uni.hideLoading();
}, 1000)
} else {
uni.showLoading({ title: '支付成功, 跳转订单页' });
wx.miniProgram.getEnv((wx) => {
if (wx.miniprogram) {
this.$Payment.H5TOWX_Payment({
datas: res['data'],
GetShopInfor: {
@ -466,6 +468,13 @@
shopInfo: from.products,
return_url:`/pages/restaurant/order/order-details/details?order_sn=${res.data.order_sn}`
});
}else {
//
const orderData = { price: this.realPayment };
window.location.href = `${HTTP_REQUEST_URL}/h5_pay/?token=${this.removeBearerPrefix(state['getters']['GetToken'])}&dat=${encodeURIComponent(JSON.stringify(res.data))}&orderData=${encodeURIComponent(JSON.stringify(orderData))}&from_type=food`;
}
})
uni.hideLoading();
}
})

View File

@ -112,7 +112,7 @@
<view class="discount" style="width: 100%; display: flex; justify-content: space-between">
<view>
<text lines="1" class="quantity">抵用券</text>
<text lines="1" class="amount">({{ Number(computedTotal.coin_balance) + Number(computedTotal.broker_balance)? Number(computedTotal.coin_balance) + Number(computedTotal.broker_balance) : '0.00' }} )</text>
<text lines="1" class="amount">({{ Number(computedTotal.coin_balance) + Number(computedTotal.broker_balance)? (Number(computedTotal.coin_balance) + Number(computedTotal.broker_balance)).toFixed(2) : '0.00' }} )</text>
</view>
<view class="Checkbox" :style="{'--aftercolor':Brand()['ThemeColor']}" :class="{'active-Checkbox': use_coin? true : false}"></view>
</view>
@ -231,6 +231,8 @@
</template>
<script>
import { HTTP_REQUEST_URL } from '@/config/app.js';
import state from '@/store/index';
//
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
@ -453,6 +455,9 @@
uni.hideLoading();
}, 1000)
} else {
wx.miniProgram.getEnv((wx) => {
if (wx.miniprogram) {
//
this.$Payment.H5TOWX_Payment({
datas: res['data'],
GetShopInfor: {
@ -471,11 +476,49 @@
shopInfo: FormInfor.products,
return_url:`/pages/restaurant/order/order-details/details?order_sn=${res.data.order_sn}`
});
}else {
//
const orderData = { price: this.realPayment };
window.location.href = `${HTTP_REQUEST_URL}/h5_pay/?token=${this.removeBearerPrefix(state['getters']['GetToken'])}&dat=${encodeURIComponent(JSON.stringify(res.data))}&orderData=${encodeURIComponent(JSON.stringify(orderData))}&from_type=food`;
//
// window.location.href = `http://10.210.254.149:8080/h5_pay/?token=${this.removeBearerPrefix(state['getters']['GetToken'])}&dat=${encodeURIComponent(JSON.stringify(res.data))}&orderData=${encodeURIComponent(JSON.stringify(orderData))}&from_type=food`;
}
})
uni.hideLoading();
}
})
},
testBrowser() {
let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') return 'weixin'; //
if (ua.match(/dsapp/i) == 'isapp') return 'other_app'; // -app
//uaappdsapp
// #ifdef APP-PLUS
return 'self_app'; // -app
// #endif
// #ifdef MP-WEIXIN
return 'mp-weixin'; // -
// #endif
return 'h5';
},
removeBearerPrefix(tokenString) {
/**
* 移除字符串开头的 'Bearer ' 前缀包括空格
*
* @param {string} tokenString - 包含 Bearer 前缀的 token 字符串
* @returns {string} 移除 Bearer 前缀后的纯 token 字符串
*/
const bearerPrefix = "Bearer ";
if (tokenString.startsWith(bearerPrefix)) {
return tokenString.substring(bearerPrefix.length);
}
return tokenString;
},
/**
* @商品是否优惠
* */

View File

@ -187,6 +187,16 @@ class Request {
// 固定写入
config['header']['authori-zation'] = state['getters']['GetToken'];
wx.miniProgram.getEnv((wx) => {
if (wx.miniprogram) {
// 小程序环境
config['header']['form-type'] = 'routine';
}else {
//非小程序环境
config['header']['form-type'] = 'gzh';
}
})
console.log(cityInfor, '定位信息头')
if (cityInfor?.city) {
// config['header']['city'] = encodeURIComponent(cityInfor['city']);
@ -197,15 +207,11 @@ class Request {
// config['header']['lng'] = cityInfor['lon'];
config['header']['lng'] = cityInfor['lng'];
config['header']['adcode'] = cityInfor['adcode'];
// type
config['header']['form-type'] = 'routine';
} else {
// 后台判定该参数为空所以在没有的情况下需要传空值
config['header']['city'] = '';
config['header']['lat'] = '';
config['header']['adcode'] = '';
config['header']['form-type'] = 'routine';
};
// config['header']['ApiToken'] =
// 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NjM4MTYzMTAsIm5iZiI6MTY2MzgxNjMxMCwiZXhwIjoxNjY2NDA4MzEwLCJkYXRhIjp7ImNsaWVudF9pZCI6MX19.db_hFkDJ2dogkvDkhaBj5W5gti3bFHWWRCVf3-PyF-E';

View File

@ -17,6 +17,7 @@ class Payment {
* @param {String} redirect 是否关闭调起支付的页面
* 该方法没有支付失败和成功回调函数必须由微信支付完成之后跳转至指定页面去查询订单状态然后根据订单状态再跳转值业务页面
*/
// H5拉起微信支付
H5TOWX_Payment(data) {
console.log(data, '111111')
uni.showLoading({
@ -110,6 +111,15 @@ class Payment {
}
}
/**
* @param {String} data 支付参数
* H5跳转收银台
*/
H5TOWX_WEB(data) {
// window.location.href = ` http://10.210.254.149:8081/h5_pay/?token=${store.state.app.token}&order_id=${res.data.result.orderId}&from_type=order`;
}
/**
* @param {String} pay_price 支付金额
* @param {String} order_sn 订单号

BIN
unpackage/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>在线点餐</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.48d1c479.js></script><script src=/privilege/static/js/index.ea748e74.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.e3fc7d65.js></script><script src=/privilege/static/js/index.3ba0a0d9.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,7 @@ class Payment {
* @param {String} redirect 是否关闭调起支付的页面
* 该方法没有支付失败和成功回调函数必须由微信支付完成之后跳转至指定页面去查询订单状态然后根据订单状态再跳转值业务页面
*/
// H5拉起微信支付
H5TOWX_Payment(data) {
console.log(data, '111111')
uni.showLoading({
@ -110,6 +111,15 @@ class Payment {
}
}
/**
* @param {String} data 支付参数
* H5跳转收银台
*/
H5TOWX_WEB(data) {
// window.location.href = ` http://10.210.254.149:8081/h5_pay/?token=${store.state.app.token}&order_id=${res.data.result.orderId}&from_type=order`;
}
/**
* @param {String} pay_price 支付金额
* @param {String} order_sn 订单号

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long