1.app.vue主题功能兼容性优化

master
sws 2023-09-26 14:58:13 +08:00
parent ef330f7c7a
commit c7cc794e01
4 changed files with 57 additions and 367 deletions

31
App.vue
View File

@ -1775,36 +1775,7 @@
//
require_theme() {
let theme = this.get_theme_value();
// import `@/common/css/theme/${theme}.css`; //import
switch (theme) {
case 'yellow':
require(`@/common/css/theme/yellow.css`);
break;
case 'red':
require(`@/common/css/theme/red.css`);
break;
case 'black':
require(`@/common/css/theme/black.css`);
break;
case 'green':
require(`@/common/css/theme/green.css`);
break;
case 'orange':
require(`@/common/css/theme/orange.css`);
break;
case 'blue':
require(`@/common/css/theme/blue.css`);
break;
case 'brown':
require(`@/common/css/theme/brown.css`);
break;
case 'purple':
require(`@/common/css/theme/purple.css`);
break;
default:
require(`@/common/css/theme/red.css`);
break;
}
require(`@/common/css/theme/${theme}.css`);
},
//

View File

@ -1,84 +1,96 @@
/**
*
*/
/**
*
*/
.goods-comment-item {
padding-bottom: 10rpx;
}
.goods-comment-item .avatar {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
border: 1px solid #e2e2e2;
}
.goods-comment-item .base-nav {
width: calc(100% - 90rpx);
line-height: 50rpx;
}
.goods-comment-item .base-nav text:not(:last-child) {
margin-right: 5rpx;
}
.goods-comment-item .base-content .content,
.goods-comment-item .base-content .reply {
line-height: 46rpx;
}
.goods-comment-item .base-content .images image {
width: 100rpx;
height: 100rpx;
}
.goods-comment-item .base-content .images image:not(:last-child) {
margin-right: 10rpx;
}
}
/*
* -
*/
.panel-item .panel-content .item:last-child {
border: 0 !important;
border: 0 !important;
padding-bottom: 0 !important;
}
.panel-item .panel-content .item .title {
width: 25%;
}
.panel-item .panel-content .item .content {
width: calc(75% - 44rpx);
min-height: 46rpx;
word-wrap: break-word;
word-break: normal;
}
.panel-item .panel-content .item .title,
.panel-item .panel-content .item .title,
.panel-item .panel-content .item .content {
line-height: 46rpx;
}
.panel-item-only .panel-content .item .content {
width: 100%;
}
}
.panel-item-only .panel-content .item .content {
width: 100%;
}
/*
* -
*/
.panel-item .panel-content-images .item {
margin: 20rpx 20rpx 0 0;
}
.panel-item .panel-content-images .item:last-child {
margin-right: 0;;
}
.panel-item .panel-content-images .item:last-child {
margin-right: 0;
}
.panel-item .panel-content-images .item image {
width: 120rpx;
height: 120rpx !important;
}
/**
* 线
*/
}
/**
* 线
*/
.address-divider {
height: 4px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAECAYAAADWIIyPAAAAkklEQVR42mP4jwR+7tr1/4OzM1Xwt46O/6SA3Yd//HeLeU0V3DXjE0H7GGCMvw8f/v/o5UUVT39KTPz/78cPoj398Omf/75Jb6ji6ZSyd/9//PxHnMdBjvyUlEQVT4MC7++DB0R7GuTIlPJ3VPE0KPAePvlDlL1gj3/r6qJaEv+5YwdJSbxn5meqJfGdh74TbS8A1dn662xhNdIAAAAASUVORK5CYII=");
background-repeat-y: no-repeat;
}
/**
* html
*/
}
/**
* html
*/
.popup-pay-html-content {
max-height: 80vh;
overflow-y: scroll;

View File

@ -10,7 +10,6 @@
<button class="bg-main br-main cr-white round" type="default" hover-class="none" size="mini" @tap="back_event"></button>
</view>
<view v-if="(params.page || null) != null && (params.title || null) != null" class="margin-top-lg">
<!-- <navigator class="dis-inline-block" :url="'/pages/' + params.page + '/' + params.page" open-type="redirect"> -->
<navigator class="dis-inline-block" :url="'/pages/' + params.page" open-type="redirect">
<button class="bg-main-pair br-main-pair cr-white round" type="default" hover-class="none" size="mini">{{ params.title }}</button>
</navigator>

View File

@ -99,60 +99,18 @@
<button class="bottom-fixed pay-merge-submit bg-green cr-white round" type="default" size="mini" hover-class="none" @tap="pay_merge_event"></button>
</view>
<!-- 支付二维码展示 -->
<component-popup :propShow="popup_view_pay_qrcode_is_show" propPosition="bottom" @onclose="popup_view_pay_qrcode_event_close">
<view class="padding-top-xxxl padding-bottom-xxxl padding-left-xxxl padding-right-xxxl tc">
<block v-if="(popup_view_pay_data || null) == null || (popup_view_pay_data.qrcode_url || null) == null || (popup_view_pay_data.name || null) == null || (popup_view_pay_data.check_url || null) == null || (popup_view_pay_data.order_no || null) == null">
<text class="cr-grey">无支付信息</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 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">
<a :href="popup_view_pay_data.pay_url" target="_blank" class="dis-inline-block cr-green">尝试点击去支付</a>
</view>
<!-- #endif -->
</block>
</view>
</component-popup>
<!-- 支付html展示 -->
<component-popup :propShow="popup_view_pay_html_is_show" propPosition="bottom" @onclose="popup_view_pay_html_event_close">
<view class="popup-pay-html-content padding-top-xxxl padding-bottom-xxxl padding-left-xxxl padding-right-xxxl tc">
<block v-if="(popup_view_pay_data || null) == null">
<text class="cr-grey">无支付信息</text>
</block>
<block v-else>
<mp-html :content="popup_view_pay_data" />
</block>
</view>
</component-popup>
<!-- 支付方式 popup -->
<component-popup :propShow="is_show_payment_popup" propPosition="bottom" @onclose="payment_popup_event_close">
<view v-if="payment_list.length > 0" class="payment-list oh bg-base padding-main">
<view class="padding-top-main padding-left-main">
<view v-for="(item, index) in payment_list" :key="index" class="item tc fl">
<view class="item-content bg-white border-radius-main margin-right-main margin-bottom-main" :data-value="item.id" :data-type="item.payment" @tap="popup_payment_event">
<image v-if="(item.logo || null) != null" class="icon va-m margin-right-sm" :src="item.logo" mode="widthFix"></image>
<text class="va-m">{{ item.name }}</text>
</view>
</view>
</view>
</view>
<view v-else class="padding-top-xxxl padding-bottom-xxxl oh bg-white tc cr-grey">没有支付方式</view>
</component-popup>
<component-payment
:prop-pay-url="pay_url"
:prop-qrcode-url="qrcode_url"
:prop-payment-list="payment_list"
:prop-to-page="to_page"
prop-pay-data-key="ids"
:prop-temp-pay-value="temp_pay_value"
:prop-temp-pay-index="temp_pay_index"
:prop-pay-price="pay_price"
:prop-is-show-payment="is_show_payment_popup"
@close-payment-poupon="payment_popup_event_close"
@pay-success="order_item_pay_success_handle"
></component-payment>
</view>
</template>
@ -178,12 +136,7 @@
data_is_loading: 0,
params: null,
input_keyword_value: '',
load_status: 0,
is_show_payment_popup: false,
payment_list: [],
payment_id: 0,
payment_type: '',
temp_pay_value: '',
nav_status_list: [
{ name: '全部', value: '-1' },
{ name: '待付款', value: '1' },
@ -203,6 +156,20 @@
home_is_enable_order_bulk_pay: 0,
//
params: '',
//
to_page: {
title: '前往订单页',
page: 'user-order/user-order',
msg: '支付成功',
},
pay_price: 0,
pay_url: '',
qrcode_url: '',
payment_list: [],
temp_pay_value: '',
temp_pay_index: 0,
payment_id: 0,
is_show_payment_popup: false,
};
},
@ -348,8 +315,6 @@
temp_data_list.push(temp_data[i]);
}
}
var temp_load_status = this.load_status;
this.setData({
payment_list: res.data.data.payment_list || [],
data_list: temp_data_list,
@ -357,21 +322,9 @@
data_page_total: res.data.data.page_total,
data_list_loding_status: 3,
data_page: this.data_page + 1,
load_status: 1,
data_is_loading: 0,
});
//
if (temp_load_status == 0) {
var ck = app.globalData.data.cache_page_pay_key;
var pay_data = uni.getStorageSync(ck) || null;
if (pay_data != null) {
uni.removeStorageSync(ck);
this.setData({ payment_id: parseInt(pay_data.payment_id || 0) });
this.pay_handle(pay_data.order_ids);
}
}
//
this.setData({
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
@ -395,14 +348,12 @@
data_list_loding_status: 0,
data_bottom_line_status: false,
data_list: [],
load_status: 1,
data_is_loading: 0,
});
}
} else {
this.setData({
data_list_loding_status: 0,
load_status: 1,
data_is_loading: 0,
});
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
@ -415,7 +366,6 @@
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
load_status: 1,
data_is_loading: 0,
});
app.globalData.showToast('服务器请求出错');
@ -458,43 +408,6 @@
//
pay_handle(order_ids) {
// #ifdef H5
// web_openid
if (!app.globalData.is_user_weixin_web_openid(order_ids, this.payment_id)) {
return false;
}
// #endif
//
var payment = null;
for (var i in this.payment_list) {
if (this.payment_list[i]['id'] == this.payment_id) {
payment = this.payment_list[i];
}
}
//
var post_data = {
ids: order_ids,
payment_id: this.payment_id,
};
// h5
// #ifdef H5
if (payment != null) {
post_data['redirect_url'] = encodeURIComponent(base64.encode(app.globalData.get_page_url(false) + (this.nav_status_index > 0 ? '?status=' + this.nav_status_index : '')));
// paypal使respond_url
if (payment.payment == 'PayPal') {
post_data['respond_url'] = post_data['redirect_url'];
delete post_data['redirect_url'];
}
}
// #endif
//
uni.showLoading({
title: '请求中...',
});
uni.request({
url: app.globalData.get_request_url('pay', 'order'),
method: 'POST',
@ -572,214 +485,9 @@
});
},
//
kuaishou_pay_handle(self, data, order_ids) {
uni.pay({
orderInfo: data.data,
serviceId: '1',
success: (res) => {
//
self.order_item_pay_success_handle(order_ids);
//
uni.navigateTo({
url: '/pages/paytips/paytips?code=9000',
});
},
fail: (res) => {
app.globalData.showToast('支付失败');
},
});
},
// QQ
common_pay_handle(self, data, order_ids) {
uni.requestPayment({
// #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-KUAISHOU
orderInfo: data.data,
// #endif
// #ifdef MP-QQ
package: data.data,
// #endif
// #ifdef MP-WEIXIN
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
// #endif
// #ifdef MP-TOUTIAO
service: 5,
// #endif
success: (res) => {
// #ifdef MP-ALIPAY
if (res.resultCode != 9000) {
app.globalData.showToast(res.memo || '支付失败');
return false;
}
// #endif
// #ifdef MP-TOUTIAO
if (res.code != 0) {
app.globalData.showToast('支付失败');
return false;
}
// #endif
//
self.order_item_pay_success_handle(order_ids);
//
uni.navigateTo({
url: '/pages/paytips/paytips?code=9000',
});
},
fail: (res) => {
app.globalData.showToast('支付失败');
},
});
},
// QQ
qq_pay_handle(self, data, order_ids) {
//
if (data.payment.payment == 'Weixin') {
uni.requestWxPayment({
url: data.data,
referer: app.globalData.data.request_url,
success: function (res) {
app.globalData.alert({ msg: '支付成功后、请不要重复支付、如果订单状态未成功请联系客服处理', is_show_cancel: 0 });
self.get_data_list();
},
fail: function (res) {
app.globalData.showToast('支付失败');
},
});
} else {
self.common_pay_handle(self, data, order_ids);
}
},
// h5
h5_pay_handle(self, data, order_ids) {
//
if (typeof data.data == 'string') {
window.location.href = data.data;
} else {
var status = false;
// jsapi
if (data.payment.payment == 'Weixin' && (data.data.appId || null) != null && (data.data.timeStamp || null) != null && (data.data.nonceStr || null) != null && (data.data.package || null) != null && (data.data.signType || null) != null && (data.data.paySign || null) != null) {
status = true;
function onBridgeReady() {
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
{
appId: data.data.appId,
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
},
function (res) {
if (res.err_msg == 'get_brand_wcpay_request:ok') {
//
self.order_item_pay_success_handle(order_ids);
//
uni.navigateTo({
url: '/pages/paytips/paytips?code=9000',
});
}
}
);
}
if (typeof WeixinJSBridge == 'undefined') {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
} else {
onBridgeReady();
}
}
//
if ((data.data.qrcode_url || null) != null && (data.data.name || null) != null && (data.data.check_url || null) != null && (data.data.order_no || null) != null) {
status = true;
//
this.setData({
popup_view_pay_data: data.data,
popup_view_pay_qrcode_is_show: true,
});
//
var timer = setInterval(function () {
uni.request({
url: app.globalData.get_request_url('paycheck', 'order'),
method: 'POST',
data: {
order_no: self.popup_view_pay_data.order_no,
},
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
//
clearInterval(self.popup_view_pay_timer);
self.setData({
popup_view_pay_data: null,
popup_view_pay_qrcode_is_show: false,
});
//
self.order_item_pay_success_handle(order_ids);
//
uni.navigateTo({
url: '/pages/paytips/paytips?code=9000',
});
} else {
// -300
if (res.data.code != -300) {
clearInterval(self.popup_view_pay_timer);
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
clearInterval(self.popup_view_pay_timer);
app.globalData.showToast('服务器请求出错');
},
});
}, 3000);
self.setData({
popup_view_pay_timer: timer,
});
}
// html
if ((data.data.html || null) != null) {
status = true;
var div = document.createElement('paydivform');
div.innerHTML = data.data.html;
document.body.appendChild(div);
var fm = document.forms;
var fm_len = fm.length;
if (fm_len > 0) {
fm[fm_len - 1].submit();
}
}
//
if (!status) {
app.globalData.showToast(data.payment.name + '支付方式还未适配');
}
}
},
//
order_item_pay_success_handle(order_ids) {
//
order_item_pay_success_handle(data, index, order_ids) {
var order_ids_arr = order_ids.split(',');
var temp_data_list = this.data_list;