收银台优化,网络验证仅对app有效

This commit is contained in:
gongfuxiang
2025-07-29 20:56:42 +08:00
parent 5bd5aadc63
commit 9638e5da9f
17 changed files with 233 additions and 122 deletions

View File

@ -7,8 +7,10 @@
<text class="cr-grey">{{$t('payment.payment.973g2e')}}</text>
</block>
<block v-else>
<view class="fw-b text-size cr-base margin-bottom-sm">{{ popup_view_pay_data.name }}</view>
<image :src="popup_view_pay_data.qrcode_url" mode="aspectFit" class="dis-block auto max-w"></image>
<view class="fw-b text-size cr-base margin-bottom-sm">{{ popup_view_pay_data.name }}</view>
<view class="dis-inline-block">
<w-qrcode :options="{code:popup_view_pay_data.qrcode_url, size:450}"></w-qrcode>
</view>
<view v-if="(popup_view_pay_data.msg || null) != null" class="cr-yellow margin-top-sm">{{ popup_view_pay_data.msg }}</view>
<!-- #ifdef H5 -->
<view v-if="popup_view_pay_data.pay_url != null" class="margin-top-xl">
@ -101,7 +103,9 @@
// 支付返回数据
pay_response_data: {},
// 支付确认弹窗
payment_confirm_modal_status: false,
payment_confirm_modal_status: false,
// 微信app
weixinapp: null,
};
},
props: {
@ -234,7 +238,26 @@
this.setData({
payment_list: this.propPaymentList,
payment_id: Number(this.propPaymentId) == 0 ? this.propDefaultPaymentId : Number(this.propPaymentId),
});
});
// #ifdef APP
// 是否存在微信app
var self = this;
plus.share.getServices(res => {
let weixinapp = null;
for(let i in res) {
if(res[i].id == 'weixin') {
weixinapp = res[i];
break;
}
}
if(weixinapp) {
self.setData({
weixinapp: weixinapp
});
}
});
// #endif
},
methods: {
// 支付弹窗关闭
@ -460,7 +483,8 @@
// APP支付
app_pay_handle(self, data, order_id) {
var arr = {
Alipay: 'alipay',
Alipay: 'alipay',
AlipayCert: 'alipay',
Weixin: 'wxpay',
PayPal: 'paypal'
}
@ -493,7 +517,27 @@
}
}
});
} else {
} else {
// 是否打开微信app
var status = true;
if(data.data.substr(0, 12) == 'weixinapp://') {
if(this.weixinapp == null) {
app.globalData.showToast(this.$t('detail.detail.86g7e1'));
return false;
}
var weixin_original_id = app.globalData.get_config('config.common_app_mini_weixin_share_original_id', null);
if(weixin_original_id == null) {
app.globalData.showToast(this.$t('detail.detail.567uyh'));
return false;
}
this.weixinapp.launchMiniProgram({
id: weixin_original_id,
type: 0,
path: data.data.substr(12)
});
status = false;
}
// 先清除定时任务
if(self.open_pay_url_timer != null) {
clearTimeout(self.open_pay_url_timer);
@ -507,15 +551,17 @@
self.setData({
open_pay_url_status: true
});
// 打开url
plus.runtime.openURL(data.data, function(error) {
uni.hideLoading();
// 打开url失败、并进入提示失败环节
self.setData({
open_pay_url_status: false
});
self.order_item_pay_fail_handle(data, order_id, error.message+'('+error.code+')');
});
// 打开url
if(status) {
plus.runtime.openURL(data.data, function(error) {
uni.hideLoading();
// 打开url失败、并进入提示失败环节
self.setData({
open_pay_url_status: false
});
self.order_item_pay_fail_handle(data, order_id, error.message+'('+error.code+')');
});
}
// 定时3秒后提示用户确认支付状态
self.open_pay_url_timer = setTimeout(function() {
if(self.open_pay_url_status) {
@ -633,15 +679,17 @@
self.order_item_pay_success_handle(data, order_id);
},
fail: (res) => {
let error = res.memo || res.errMsg || null;
if(error != null) {
let msg = res.memo || res.errMsg || null;
if(msg != null) {
let code = res.resultCode || res.errCode || res.errNo || null;
if(code != null) {
error += '('+code+')';
msg += '('+code+')';
}
if(msg.indexOf('cancel') != -1) {
msg = null;
}
console.log(error);
}
self.order_item_pay_fail_handle(data, order_id, self.$t('paytips.paytips.6y488i'));
self.order_item_pay_fail_handle(data, order_id, msg || self.$t('paytips.paytips.6y488i'));
},
});
}

View File

@ -406,7 +406,7 @@
if(limit_type.length > 0) {
var type_data = this.buy_use_type_data();
if(limit_type.indexOf(type_data.data_index) != -1 || limit_type.indexOf(type_data.data_index.toString()) != -1) {
return temp['name'] + this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price;
return this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price;
}
} else {
return this.$t('realstore-cart.realstore-cart.miv944') + this.propCurrencySymbol + starting_price;

View File

@ -89,7 +89,10 @@
"not_supported_scan_tips": "H5 webpage does not support scanning codes",
"copy_link": "Copy link",
"multilingual": "multilingual",
"ver_update_tips": "Your WeChat version is too low, please update to the latest version!"
"ver_update_tips": "Your WeChat version is too low, please update to the latest version!",
"click_pay_text" : "Click to initiate payment",
"again_pay_text" : "Restart payment",
"back_app_text" : "Return to APP"
},
"client": {
"weixin": "WeChat",
@ -750,6 +753,7 @@
"y2639j": "Start time",
"fa8h7j": "poster",
"eg25j9": "Enter live",
"567uyh": "WeChat original ID is not configured in the background",
"86g7e1": "No WeChat app installed",
"9d3o6w": "Please open it in the WeChat mini program",
"6xvl35": "Generating",

View File

@ -89,7 +89,10 @@
"not_supported_scan_tips": "H5网页不支持扫码",
"copy_link": "复制链接",
"multilingual": "多语言",
"ver_update_tips": "你的微信版本过低,请更新至最新版本!"
"ver_update_tips": "你的微信版本过低,请更新至最新版本!",
"click_pay_text" : "点击发起支付",
"again_pay_text" : "重新发起支付",
"back_app_text" : "返回APP"
},
"client": {
"weixin": "微信",
@ -740,6 +743,7 @@
"y2639j": "开播时间",
"fa8h7j": "海报",
"eg25j9": "进入直播",
"567uyh": "后台没有配置微信原始id",
"86g7e1": "未安装微信APP",
"9d3o6w": "请在微信小程序中打开",
"6xvl35": "生成中...",

View File

@ -475,6 +475,25 @@
}
]
},
{
"root": "pages/cashier",
"pages": [
{
"path": "cashier",
"style": {
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || APP
"navigationStyle": "custom",
// #endif
// #ifdef MP-ALIPAY
"transparentTitle": "auto",
"titlePenetrate": "YES",
// #endif
"enablePullDownRefresh": false,
"navigationBarTitleText": ""
}
}
]
},
{
"root": "pages/paytips",
"pages": [
@ -1832,25 +1851,6 @@
}
]
},
{
"root": "pages/plugins/allocation",
"pages": [
{
"path": "cashier/cashier",
"style": {
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || APP
"navigationStyle": "custom",
// #endif
// #ifdef MP-ALIPAY
"transparentTitle": "auto",
"titlePenetrate": "YES",
// #endif
"enablePullDownRefresh": false,
"navigationBarTitleText": ""
}
}
]
},
{
"root": "pages/plugins/hospital",
"pages": [

24
pages/cashier/cashier.css Normal file
View File

@ -0,0 +1,24 @@
.page {
height: 100vh;
}
.page > .content {
padding-top: 30%;
}
/**
* 支付确认弹窗
*/
.payment-confirm-modal {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
z-index: 100;
width: 100%;
height: 100%;
}
.payment-confirm-modal .content {
margin-top: 60%;
z-index: 101;
}

View File

@ -11,16 +11,26 @@
<view :class="'cr-'+(pay_status == 1 ? 'green' : (pay_status == 2 ? 'red' : 'grey'))">{{pay_msg}}</view>
</view>
<view v-if="pay_status == 2" class="margin-top-xxxxl padding-vertical-xxxxl">
<button class="bg-green br-green cr-white round text-size-sm padding-horizontal-xxxxl" size="mini" hover-class="none" @tap="pay_handle">重新发起支付</button>
<button class="bg-green br-green cr-white round text-size-sm padding-horizontal-xxxxl" size="mini" hover-class="none" @tap="pay_handle">{{pay_btn_text}}</button>
</view>
</block>
<block v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</block>
<view v-if="is_back_btn && pay_status != 0" class="margin-top-xxxxl padding-top-xxxxl tc">
<button class="bg-white br-main cr-main round text-size-sm padding-horizontal-xxxxl" size="mini" hover-class="none" open-type="launchApp" app-parameter="wechat">返回APP</button>
<button class="bg-white br-main cr-main round text-size-sm padding-horizontal-xxxxl" size="mini" hover-class="none" open-type="launchApp" app-parameter="wechat">{{pay_back_app_text}}</button>
</view>
</view>
</view>
<!-- 支付中提示弹窗 -->
<view v-if="payment_confirm_modal_status" class="payment-confirm-modal">
<view class="content padding-xl margin-xxl tc bg-white border-radius-main">
<view class="padding-vertical-xxxxl">{{$t('common.payment_in_text')}}</view>
<view class="margin-top-lg">
<button type="default" size="mini" class="bg-white br-black cr-black text-size-sm round margin-right-xxxxl" data-type="0" @tap="payment_confirm_event">{{$t('common.not_have_name')}}</button>
<button type="default" size="mini" class="bg-main br-main cr-white text-size-sm round margin-left-xxxxl" data-type="1" @tap="payment_confirm_event">{{$t('order.order.s8g966')}}</button>
</view>
</view>
</view>
@ -47,6 +57,10 @@
data: {},
pay_status: 0,
pay_msg: '',
payment_confirm_modal_status: false,
is_first: 1,
pay_btn_text: this.$t('common.again_pay_text'),
pay_back_app_text: this.$t('common.back_app_text')
};
},
@ -98,7 +112,7 @@
success: (res) => {
if (res.code) {
uni.request({
url: app.globalData.get_request_url("paydata", "cashier", "allocation"),
url: app.globalData.get_request_url("paydata", "cashier", self.params.plugins || ''),
method: 'POST',
data: {...self.params, ...{authcode: res.code}},
dataType: 'json',
@ -115,6 +129,7 @@
this.pay_handle();
} else {
this.setData({
is_first: 0,
data_list_loding_status: 0,
data_list_loding_msg: res.data.msg,
});
@ -123,6 +138,7 @@
fail: () => {
uni.stopPullDownRefresh();
this.setData({
is_first: 0,
data_list_loding_status: 0,
data_list_loding_msg: self.$t('common.internet_error_tips'),
});
@ -133,6 +149,7 @@
fail: (e) => {
uni.stopPullDownRefresh();
this.setData({
is_first: 0,
data_list_loding_status: 0,
data_list_loding_msg: self.$t('login.login.3nmrg2'),
});
@ -141,37 +158,83 @@
},
//
pay_handle(e) {
if(this.pay_status != 1)
{
pay_handle() {
if(this.pay_status != 1) {
var self = this;
var data = self.data.pay_data;
//
if (typeof data != 'string' && (data.appid || null) != null && (data.path || null) != null && (data.order_no || null) != null) {
uni.navigateToMiniProgram({
appId: data.appid,
path: data.path,
extraData: data.extra_data || {},
success(res) {
//
self.setData({
is_first: 0,
payment_confirm_modal_status: true,
});
},
fail(res) {
self.setData({
is_first: 0,
pay_status: 2,
pay_msg: self.is_first == 1 ? '' : self.$t('paytips.paytips.6y488i'),
pay_btn_text: self.is_first == 1 ? self.$t('common.click_pay_text') : self.$t('common.again_pay_text'),
});
}
});
} else {
self.setData({
is_first: 0,
pay_status: 0,
pay_msg: self.$t('common.payment_in_text'),
});
uni.requestPayment({
timeStamp: data.timeStamp,
nonceStr: data.nonceStr,
package: data.package,
signType: data.signType,
paySign: data.paySign,
success: (res) => {
self.setData({
pay_status: 1,
pay_msg: self.$t('paytips.paytips.679rxu'),
});
},
fail: (res) => {
self.setData({
pay_status: 2,
pay_msg: self.$t('paytips.paytips.6y488i'),
});
},
});
}
}
},
//
payment_confirm_event(e) {
//
this.setData({
payment_confirm_modal_status: false,
});
//
if(parseInt(e.currentTarget.dataset.type || 0) == 1) {
this.setData({
pay_status: 0,
pay_msg: this.$t('common.payment_in_text'),
pay_status: 1,
pay_msg: this.$t('paytips.paytips.679rxu'),
});
uni.requestPayment({
timeStamp: this.data.pay_data.timeStamp,
nonceStr: this.data.pay_data.nonceStr,
package: this.data.pay_data.package,
signType: this.data.pay_data.signType,
paySign: this.data.pay_data.paySign,
success: (res) => {
this.setData({
pay_status: 1,
pay_msg: this.$t('paytips.paytips.679rxu'),
});
},
fail: (res) => {
this.setData({
pay_status: 2,
pay_msg: this.$t('paytips.paytips.6y488i'),
});
},
} else {
this.setData({
pay_status: 2,
pay_msg: this.$t('paytips.paytips.6y488i'),
});
}
}
}
};
</script>
<style>
<style scoped>
@import './cashier.css';
</style>

View File

@ -565,11 +565,13 @@
// 获取数据
init(params = {}) {
// #ifdef APP
// 网络检查
if ((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'init', params);
return false;
}
// #endif
// 请求数据
if (this.is_first == 1) {

View File

@ -501,11 +501,13 @@
params['is_cache'] = 0;
}
// #ifdef APP
// 网络检查
if ((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'init', params);
return false;
}
// #endif
// 没有缓存数据则开启加载层
if (upd_data == null) {

View File

@ -1,6 +0,0 @@
.page {
height: 100vh;
}
.page > .content {
padding-top: 20%;
}

View File

@ -19,27 +19,4 @@
.goods-image {
width: 160rpx;
height: 160rpx;
}
/*
* 地址信息
*/
.address-base,
.address-detail {
padding: 10rpx 0;
}
.address-detail .icon {
width: 30rpx;
height: 35rpx !important;
}
.address-detail .text {
width: calc(100% - 40rpx);
}
.address-detail .text {
line-height: 36rpx;
}
.address-alias,
.address-map-submit {
padding: 0 15rpx;
line-height: 40rpx;
}

View File

@ -2,24 +2,6 @@
<view :class="theme_view">
<view v-if="detail != null">
<view class="padding-horizontal-main padding-top-main">
<!-- 地址 -->
<view v-if="(detail.address_data || null) != null" class="goods bg-white padding-main border-radius-main spacing-mb">
<view class="address-base oh">
<text v-if="(detail.address_data.alias || null) != null" class="address-alias round br-main cr-main bg-white margin-right-sm">{{ detail.address_data.alias }}</text>
<text data-event="copy" :data-value="detail.address_data.name" @tap="text_event">{{ detail.address_data.name }}</text>
<text class="fr" data-event="tel" :data-value="detail.address_data.tel" @tap="text_event">{{ detail.address_data.tel }}</text>
</view>
<view class="address-detail oh margin-bottom-main">
<image class="icon fl" :src="common_static_url + 'map-icon.png'" mode="widthFix"></image>
<view class="text fr">
<text data-event="copy" :data-value="detail.address_data.province_name + detail.address_data.city_name + detail.address_data.county_name + detail.address_data.address" @tap="text_event"
>{{ detail.address_data.province_name }}{{ detail.address_data.city_name }}{{ detail.address_data.county_name }}{{ detail.address_data.address }}</text
>
</view>
</view>
<view class="address-divider spacing-mb"></view>
</view>
<!-- 基础信息 -->
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">{{$t('order-detail.order-detail.9er1pc')}}</view>

View File

@ -511,11 +511,13 @@
// 获取数据-初始化
get_detail_init(params = {}) {
// #ifdef APP
// 网络检查
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_detail_init');
return false;
}
// #endif
// 请求数据
uni.request({

View File

@ -237,11 +237,13 @@
methods: {
// 初始化
get_data(params = {}) {
// #ifdef APP
// 网络检查
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}
// #endif
// 请求数据
var lng = 0;

View File

@ -160,12 +160,14 @@
},
// 获取数据
get_data(params = {}) {
get_data(params = {}) {
// #ifdef APP
// 网络检查
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}
}
// #endif
// 请求数据
uni.request({

View File

@ -125,12 +125,14 @@
methods: {
// 初始化
get_data(params = {}) {
get_data(params = {}) {
// #ifdef APP
// 网络检查
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}
}
// #endif
// 请求数据
uni.request({

View File

@ -209,7 +209,8 @@
let sweixin = null;
for(let i in res) {
if(res[i].id == 'weixin') {
sweixin = res[i];
sweixin = res[i];
break;
}
}
//唤醒微信小程序
@ -223,6 +224,8 @@
app.globalData.showToast(this.$t('detail.detail.86g7e1'));
}
});
} else {
app.globalData.showToast(this.$t('detail.detail.567uyh'));
}
return false;
// #endif