Browse Source

H5适配

dev_delivery
jiazhipeng 6 days ago
parent
commit
20b9d18b68
  1. 12
      App.vue
  2. 2
      components/addressAdd.vue
  3. 10
      pages.json
  4. 7
      static/css/base.css
  5. 2
      subPackages/activity/greenOrganic.vue
  6. 9
      subPackages/food/order.vue
  7. 8
      subPackages/homestay/order.vue
  8. 9
      subPackages/line/orders.vue
  9. 7
      subPackages/order/cartOrder.vue
  10. 9
      subPackages/order/orderDetail.vue
  11. 421
      subPackages/order/orderPay.vue
  12. 8
      subPackages/order/trades.vue
  13. 4
      subPackages/pointsMall/index.vue
  14. 8
      subPackages/pointsMall/order.vue
  15. 2
      subPackages/techan/cartOrder.vue
  16. 8
      subPackages/techan/index.vue
  17. 19
      subPackages/techan/order.vue
  18. 8
      subPackages/ticket/order.vue

12
App.vue

@ -39,6 +39,18 @@
}
/* #endif */
/* #ifdef H5 */
.uni-body{
line-height: normal;
}
body{
line-height: normal !important;
}
/* #endif */
.example-info {
font-size: 14px;
color: #333;

2
components/addressAdd.vue

@ -324,7 +324,7 @@
}
</script>
<style scoped>
<style scoped lang="scss">
.addressadd-bg {
width: 100%;
height: 100%;

10
pages.json

@ -58,6 +58,16 @@
"navigationBarTitleText": "uni-app"
}
},
// #ifdef H5
{
"path": "order/orderPay",
"style": {
"navigationBarTitleText": "支付",
"navigationStyle": "custom"
}
},
// #endif
{
"path" : "search/index",
"style" : {

7
static/css/base.css

@ -124,3 +124,10 @@ view {
line-height: 33rpx;
}
/* #ifdef H5 */
.flex-row-scroll-view .uni-scroll-view-content{
display: flex;
}
/* #endif */

2
subPackages/activity/greenOrganic.vue

@ -13,7 +13,7 @@
<image v-show="typeIndex!=i" mode="aspectFill" :src="item.img"></image>
</view>
</view> -->
<scroll-view class="type-container type-scroll" scroll-x="true" scroll-with-animation="true" enable-flex
<scroll-view class="type-container type-scroll flex-row-scroll-view" scroll-x="true" scroll-with-animation="true" enable-flex
:scroll-into-view="scrollIntoView" :show-scrollbar="false">
<view :id="`item-${i}`" :class="['type-item']" @click="changeTypeIndex(i)"
v-for="(item,i) in typeList" :key="i">

9
subPackages/food/order.vue

@ -259,6 +259,7 @@
console.log(res.data.order_id);
let order_id = res.data.order_id
this.$store.commit("choseCoupon", "");
// #ifdef MP-WEIXIN
this.Post({
order_id: order_id,
pay_method: 'WEIXIN',
@ -282,6 +283,14 @@
})
}
})
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +order_id
})
// #endif
}
})
},

8
subPackages/homestay/order.vue

@ -333,6 +333,7 @@ export default {
console.log('成功');
if (res.code == 1) {
uni.removeStorageSync('hotelOrderInfo');
// #ifdef MP-WEIXIN
this.Post({
order_id: res.data.order_id,
pay_platform: "MINI",
@ -353,6 +354,13 @@ export default {
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +res.data.order_id
})
// #endif
}
});
},

9
subPackages/line/orders.vue

@ -258,7 +258,7 @@
let order_id = res.data.order_id
this.$store.commit("changeLineInfo", null);
this.$store.commit("choseCoupon", "");
// #ifdef MP-WEIXIN
this.Post({
order_id: order_id,
pay_platform: "MINI",
@ -282,6 +282,13 @@
})
}
})
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +order_id
})
// #endif
}
})
}

7
subPackages/order/cartOrder.vue

@ -457,6 +457,7 @@ export default {
this.$store.commit("changeTicketOrderList", []);
this.$store.commit("changeFoodOrderList", []);
this.$store.commit("changeHotelOrderList", []);
// #ifdef MP-WEIXIN
this.Post({
order_id: res.data.order_id,
pay_platform: "MINI",
@ -477,7 +478,13 @@ export default {
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +res.data.order_id
})
// #endif
}
})

9
subPackages/order/orderDetail.vue

@ -726,6 +726,7 @@
},
//
setOrderId(id) {
// #ifdef MP-WEIXIN
this.Post({
order_id: this.info.order_id,
pay_platform: "MINI",
@ -745,6 +746,13 @@
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +this.info.order_id
})
// #endif
},
//
openMask(item) {
@ -1220,6 +1228,7 @@
background-color: #fff;
border-top: 10rpx solid #F7F7F7;
padding: 0 26rpx;
box-sizing: border-box;
.bottom-price {
font-weight: 500;

421
subPackages/order/orderPay.vue

@ -0,0 +1,421 @@
<template>
<view class="bg">
<uni-page-head uni-page-head-type="default">
<div class="uni-page-head" style="background-color: rgb(248, 248, 248); color: rgb(0, 0, 0);">
<div class="uni-page-head-hd">
<div class="uni-page-head-btn" @click="clickBack()">
<uni-icons type="left" size="27"></uni-icons>
</div>
<div class="uni-page-head-ft"></div>
</div>
<div class="uni-page-head-bd">
<div class="uni-page-head__title" style="font-size: 16px; opacity: 1;">
支付
</div>
</div>
<div class="uni-page-head-ft"></div>
</div>
<div class="uni-placeholder"></div>
</uni-page-head>
<view class="title">支付剩余时间</view>
<view class="time-box">
<uni-countdown :font-size="40" :show-day="false" :hour="times.hours" :minute="times.minutes"
:second="times.seconds" @timeup="timeup"></uni-countdown>
</view>
<view class="money-box" style="padding-bottom: 30rpx;">
<view>应付金额</view>
<view style="color: red;">{{detail.paid_money / 100}}</view>
</view>
<view class="money-box" style="border-bottom: none;">
<view>支付方式:</view>
</view>
<!-- 优惠券 -->
<view v-if="coupon_activity">
<view class="pay-box" @click="payType = 1" v-if="pay_type.includes('WEIXIN')">
<view style="display: flex; align-items: center;">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/wxPay.png" mode="widthFix"></image>
微信支付
</view>
<view class="select-box">
<view class="select" v-if="payType == 1"></view>
</view>
</view>
<view v-if="walletList.length > 0 && pay_type.includes('SUBWALLET')">
<view class="pay-box">
<view style="display: flex; align-items: center;">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/numLogo.png" mode="widthFix">
</image>
数字人民币子钱包支付
</view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/selectB.png" class="select-img"
mode="widthFix" :style="{'transform': showMore ? 'rotate(180deg)' : ''}"
@click="showMore = !showMore"></image>
</view>
<view v-show="showMore" style="padding-left: 40rpx;">
<view class="pay-box" v-for="(item,index) in walletList" :key="index" @click="payType = 2;walletIndex = index">
<view style="display: flex; align-items: center;">
<image :src="item.bank_logo" mode="widthFix"></image>
{{item.bank_name}}
</view>
<view class="select-box">
<view class="select" v-if="payType == 2 && walletIndex === index"></view>
</view>
</view>
</view>
</view>
</view>
<view class="" v-else>
<view class="pay-box" @click="payType = 1">
<view style="display: flex; align-items: center;">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/wxPay.png" mode="widthFix"></image>
微信支付
</view>
<view class="select-box">
<view class="select" v-if="payType == 1"></view>
</view>
</view>
<view v-if="walletList.length > 0">
<view class="pay-box">
<view style="display: flex; align-items: center;">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/numLogo.png" mode="widthFix">
</image>
数字人民币子钱包支付
</view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/selectB.png" class="select-img"
mode="widthFix" :style="{'transform': showMore ? 'rotate(180deg)' : ''}"
@click="showMore = !showMore"></image>
</view>
<view v-show="showMore" style="padding-left: 40rpx;">
<view class="pay-box" v-for="(item,index) in walletList" :key="index" @click="payType = 2;walletIndex = index">
<view style="display: flex; align-items: center;">
<image :src="item.bank_logo" mode="widthFix"></image>
{{item.bank_name}}
</view>
<view class="select-box">
<view class="select" v-if="payType == 2 && walletIndex === index"></view>
</view>
</view>
</view>
</view>
</view>
<view class="btn" @click="pay">
立即付款
</view>
</view>
</template>
<script>
export default {
data() {
return {
id: '',
token: {},
detail: {},
closeTime: 1000 * 60 * 30,
times: {},
showMore: true,
walletList: [],
walletIndex: 0,
payType: null,
coupon_activity: false,
pay_type: "",
JDSZAPIURL: 'https://api.cloud.sz-trip.com'
}
},
onReady() {
},
onLoad(option) {
this.id = option.orderId
// this.Post({}, '/api/subwallet.ermb/wallet').then(res => {
// this.walletList = res.data
// })
this.Post({order_id: option.orderId}, "/api/order/query").then(res => {
//
if(res.data.coupon_activity && res.data.coupon_activity.pay_type) {
this.coupon_activity = true
this.pay_type = res.data.coupon_activity.pay_type
}
if(res.data.paid_money == 0) {
uni.redirectTo({
url: '/subPackages/order/trades'
})
return;
}
this.detail = res.data
let createTime = new Date((this.detail.create_time + "").replace(/-/g, "/")).getTime();
createTime += this.detail.auto_close_time * 1000;
this.closeTime = createTime - new Date().getTime();
const hours = parseInt((this.closeTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = parseInt((this.closeTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = (this.closeTime % (1000 * 60)) / 1000;
this.times = {
hours: hours,
minutes: minutes,
seconds: seconds
}
})
},
onShow() {
},
onBackPress() {
return true; // true
},
methods: {
//
clickBack () {
let pages = getCurrentPages()
let prePage = null
//
if (pages.length>=2) {
prePage = pages[pages.length - 2];
} else {
uni.redirectTo({
url: "/subPackages/order/trades"
})
return
}
//
if (prePage.$page.fullPath.indexOf('trades')>=0 || prePage.$page.fullPath.indexOf('orderDetail')>=0) {
uni.navigateBack()
} else {
uni.redirectTo({
url: "/subPackages/order/trades"
})
}
},
//
timeup() {
let flag = false
setTimeout(() => {
flag = true
}, 2000)
if (flag) {
console.log('倒计时结束')
}
},
//
pay() {
if(this.payType == null) {
uni.showToast({
title: '请选择支付方式',
icon: 'none'
})
return;
}
uni.showLoading({
title: '加载中'
})
if(this.payType == 1) {
//
uni.request({
method: 'POST',
url: this.JDSZAPIURL + '/api/order/pay',
header: {
'content-type': 'application/json',
'token': this.token
},
data: {
order_id: this.id,
pay_method: "WEIXIN",
pay_platform: "MINI",
app_name: "WxXcxConfig"
},
success: res => {
uni.hideLoading()
if (res.data.code == 1) {
let data = JSON.parse(res.data.data)
uni.requestPayment({
nonceStr: data.nonceStr || data.noncestr,
package: data.package,
paySign: data.paySign || data.sign,
signType: data.signType,
timeStamp: "" + (data.timeStamp || data.timestamp),
complete: function(res) {
// setTimeout(() => {
// uni.redirectTo({
// url: '/subPackages/order/trades'
// })
// }, 1000)
}
});
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
})
}
},
})
}else if(this.payType == 2) {
//
uni.request({
method: 'POST',
url: this.JDSZAPIURL + '/api/subwallet.ermb/wallet',
header: {
'content-type': 'application/json',
'token': this.token
},
data: {
order_id: this.id,
pay_method: "SUBWALLET",
pay_platform: "MWEB",
ins_no: this.walletList[this.walletIndex].ins_no,
return_url: "https://m.cloud.sz-trip.com/OrderWaiting",
},
success: res => {
uni.request({
method: 'POST',
url: this.JDSZAPIURL + '/api/order/pay',
header: {
'content-type': 'application/json',
'token': this.token
},
data: {
order_id: this.id,
pay_method: "SUBWALLET",
pay_platform: "MWEB",
ins_no: this.walletList[this.walletIndex].ins_no,
return_url: "https://https://m.cloud.sz-trip.com/OrderWaiting",
},
success: res => {
let data = JSON.parse(res.data.data);
if(data && data.RESULT && data.RESULT=='Y'){
uni.request({
method: 'POST',
url: this.JDSZAPIURL + '/api/order/query',
header: {
'content-type': 'application/json',
'token': this.token
},
data: {
order_id: this.id,
},
success: res => {
uni.hideLoading()
if (res.data.data.state != "UNPAID") {
uni.redirectTo({
url: '/subPackages/order/trades'
})
} else {
uni.showToast({
title: '未查询到支付结果!',
icon: 'none'
})
}
},
complete: (res) => {uni.hideLoading()}
})
} else {
uni.hideLoading()
if (res.data.code!=1 && res.data.msg) {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
}
},
})
},
})
}
}
}
}
</script>
<style scoped lang="scss">
.bg {
box-sizing: border-box;
}
.title {
text-align: center;
font-size: 35rpx;
line-height: 60rpx;
padding-top: 100rpx;
}
.time-box {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 100rpx;
}
.money-box {
width: 670rpx;
margin: 30rpx auto 0;
font-size: 35rpx;
display: flex;
justify-content: space-between;
border-bottom: 1rpx solid #000;
height: 60rpx;
align-items: center;
}
.pay-box {
padding: 0 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 35rpx;
margin-top: 40rpx;
image {
width: 70rpx;
margin-right: 20rpx;
}
.select-box {
width: 35rpx;
height: 35rpx;
display: flex;
justify-content: center;
align-items: center;
border: 1rpx solid #000;
border-radius: 50%;
.select {
width: 15rpx;
height: 15rpx;
background: #000;
border-radius: 50%;
}
}
.select-img {
width: 50rpx;
height: 50rpx;
margin-right: 0rpx;
}
}
.btn {
margin: 80rpx auto 0;
width: 670rpx;
line-height: 80rpx;
text-align: center;
font-size: 40rpx;
background: #d62828;
color: #fff;
border-radius: 40rpx;
}
</style>

8
subPackages/order/trades.vue

@ -185,6 +185,7 @@ export default {
// ID
setOrderId(id) {
this.orderId = id;
// #ifdef MP-WEIXIN
this.Post({
order_id: id,
pay_platform: "MINI",
@ -205,6 +206,13 @@ export default {
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +id
})
// #endif
},
//
confirmpost(id, index) {

4
subPackages/pointsMall/index.vue

@ -40,7 +40,7 @@
<view></view>
</view>
<scroll-view class="jx-box no-scrollbar" style="height: 500rpx;"
<scroll-view class="jx-box no-scrollbar flex-row-scroll-view" style="height: 500rpx;"
enable-flex scroll-x scroll-with-animation :show-scrollbar="false"
@scrolltolower="getJXList">
<view class="jx-item" v-for="(item,i) in JXList" :key="i" @click="gotoDetail(item)">
@ -59,7 +59,7 @@
</scroll-view>
<view class="flex" style="height: 80rpx;">
<scroll-view class="type-box no-scrollbar" :scroll-into-view="scrollView"
<scroll-view class="type-box no-scrollbar flex-row-scroll-view" :scroll-into-view="scrollView"
enable-flex scroll-x scroll-with-animation :show-scrollbar="false"
>
<view :id="`scroll${i}`" :class="['type-item',typeIndex==i?'active':'']" v-for="(type,i) in typeList"

8
subPackages/pointsMall/order.vue

@ -795,6 +795,7 @@ export default {
'/api/order/create'
).then(res => {
if (res.code == 1) {
// #ifdef MP-WEIXIN
this.Post(
{
order_id: res.data.order_id,
@ -818,6 +819,13 @@ export default {
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +res.data.order_id
})
// #endif
}
});
},

2
subPackages/techan/cartOrder.vue

@ -132,7 +132,7 @@
</view>
<!-- #endif -->
<view class="popup-list" v-if="addressList.length > 0">
<view :class="['popup-item',selectInfo.contacts.id==item.id?'active':'']" v-for="(item, index) in addressList" :key="index" @click="seldThisAddress(item)">
<view :class="['popup-item',selectInfo&&selectInfo.contacts.id==item.id?'active':'']" v-for="(item, index) in addressList" :key="index" @click="seldThisAddress(item)">
<view class="item-top flex-between">
<view style="padding-right: 71rpx;">
<view class="name flex-start">

8
subPackages/techan/index.vue

@ -14,7 +14,7 @@
<!-- 正常产品 -->
<template>
<view style="width: 100%;position: relative;" :class="[methodPopShow?'methodShow':'']">
<scroll-view class="type-container scroll-view" scroll-x="true" scroll-with-animation="true" enable-flex
<scroll-view class="type-container scroll-view flex-row-scroll-view" scroll-x="true" scroll-with-animation="true" enable-flex
:scroll-into-view="scrollIntoView">
<view :id="`item-${i}`" :class="['type-item',typeIndex==i?'active':'']" v-for="(item,i) in typeParam" :key="i" @click="changeType(item,i)">
<view class="img-container" >
@ -755,11 +755,7 @@
}
}
// #ifdef H5
::v-deep .uni-scroll-view-content{
display: flex;
}
// #endif
}
.more-btn{
position: absolute;

19
subPackages/techan/order.vue

@ -106,7 +106,7 @@
<template v-if="info.user_select_type!=3||(info.user_select_type==3&&isInDeliveryTime)">
<view class="new-box" >
<view v-if="info.user_select_type==3" class="text-overflow" style="font-weight: bold;font-size: 31rpx;padding: 20rpx 20rpx 0;">{{shop.shop_name}}</view>
<view v-if="info.user_select_type==3" class="text-overflow" style="font-weight: bold;font-size: 31rpx;padding: 20rpx 20rpx 0;">{{info.pInfo.supplier_shop_name}}</view>
<view class="commodity box">
<image class="img" :src="showImg(info.sInfo.headimg)" mode="aspectFill"></image>
<view class="sku-content">
@ -138,7 +138,9 @@
运费
</view>
<view style="font-weight: 500;" >
{{!info.post?'免邮':info.post/100}}
<text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="info.postDiscount>0">{{info.postPrice/100}}</text>
<text>{{!info.post?'免邮':info.post/100}}</text>
</view>
</view>
<view class="post top-line flex-between" v-show="info.user_select_type==3">
@ -441,6 +443,9 @@ export default {
item.user_select_type = value
this.getPost()
this.getDeliveryPost()
// #ifdef H5
this.$forceUpdate()
// #endif
},
goOrderCoupon () {
@ -820,6 +825,7 @@ export default {
'/api/order/create'
).then(res => {
if (res.code == 1) {
// #ifdef MP-WEIXIN
this.Post(
{
order_id: res.data.order_id,
@ -843,6 +849,14 @@ export default {
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +res.data.order_id
})
// #endif
}
});
},
@ -898,6 +912,7 @@ export default {
background: #f2f4f7;
padding-bottom: 200rpx;
}
view {
box-sizing: border-box;
}

8
subPackages/ticket/order.vue

@ -469,6 +469,7 @@
console.log(res.data.order_id);
let order_id = res.data.order_id
this.$store.commit("choseCoupon", "");
// #ifdef MP-WEIXIN
this.Post({
order_id: order_id,
pay_platform: "MINI",
@ -487,6 +488,13 @@
})
}
})
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +order_id
})
// #endif
}
})
},

Loading…
Cancel
Save