优化页面

This commit is contained in:
wangxiaowei 2024-07-23 16:41:01 +08:00
parent 16b6927e41
commit 0e2cd7da5e
8 changed files with 204 additions and 220 deletions

@ -350,3 +350,12 @@ export function billionsWithdrawalRecord(params) {
export function localShopPay(data) {
return request.post('abutment/paytest', data)
}
// 本地生活-支付登录
export function localShopLogin(data) {
return request.post('abutment/code', data)
}
export function makeMyWxImage() {
return request.get('procurement/makeMyWxImage')
}

@ -1,155 +0,0 @@
<template>
<view>
<view class="order-details">
<view class="main">
<view class="address-wrap flex contain">
<u-time-line>
<u-time-line-item v-for="(item, index) in express" :key="index">
<template v-slot:node>
<view class="u-node">
<u-icon v-if="index == 0 && expressState == 3" name="checkmark-circle" color="#09bf6d" size="38"></u-icon>
<u-icon v-if="index == 0 && expressState != 3" name="car" color="#c3c3c3" size="38"></u-icon>
<view v-if="index > 0" class="round"></view>
</view>
</template>
<template v-slot:content>
<view>
<view class="address">
<view>
<view class="area sm m-t-10 lighter">{{item[0]}}</view>
<view class="area sm m-t-10 lighter">{{item[1]}}</view>
</view>
</view>
</view>
</template>
</u-time-line-item>
</u-time-line>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getOrderDetail,
cancelOrder,
delOrder,
confirmOrder,
getExpress
} from '@/api/order';
import {
copy
} from "@/utils/tools.js"
import { invoiceType } from "@/utils/type.js"
export default {
data() {
return {
id: 0,
express:[],
expressState: ''
};
},
onLoad: function(options) {
const {
id
} = this.$Route.query;
this.id = id;
this.handleExpress()
},
methods: {
async handleExpress() {
const {code, data, msg} = await getExpress({order_id: this.id})
if (code == 1) {
this.express = data.list
this.expressState = data.state
}
},
}
};
</script>
<style lang="scss">
.bt {
width: 100%;
text-align: right;
}
.order-details {
position: relative;
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
}
.order-details .header-bg {
position: absolute;
top: 0;
width: 100%;
height: 200rpx;
background-color: $-color-primary;
z-index: 0;
}
.order-details .goods .status {
height: 88rpx;
padding: 0 20rpx;
}
.order-details .main {
position: relative;
z-index: 1;
}
.order-details .contain {
margin: 40rpx 20rpx 20rpx;
border-radius: 14rpx;
background-color: #fff;
}
.order-details .header {
padding: 24rpx 40rpx;
box-sizing: border-box;
}
.order-details .img-line {
height: 1.5px;
width: 100%;
display: block;
}
.order-details .address-wrap {
height: auto;
padding: 40rpx 24rpx 10rpx 50rpx;
justify-content: start;
}
.order-details .order-info {
padding: 12rpx 0;
}
.order-details .order-info .item {
padding: 12rpx 24rpx;
}
.order-details .order-info .copy-btn {
font-size: 24rpx;
padding: 6rpx 18rpx;
border-radius: 8rpx;
color: $-color-primary;
background: rgba($color: $-color-primary, $alpha: .1);
}
.order-details .order-info .item .title {
width: 180rpx;
flex: none;
}
.round {
background-color: #c3c3c3;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
}
</style>

@ -1,6 +1,3 @@
<template>
<view>
<view class="goods-logistics p-t-20">

@ -33,7 +33,7 @@
</view>
</view>
<view class="address-wrap flex contain">
<u-time-line v-if="express != ''">
<u-time-line v-if="express != '' && orderDetail.order_status >= 2">
<u-time-line-item>
<template v-slot:node>
<view class="u-node bold">
@ -76,13 +76,11 @@
</u-time-line-item>
</u-time-line>
<view v-if="express == ''">
<view class="address">
<view>
<text class="name md m-r-10">{{orderDetail.consignee}}</text>
<text class="phone md">{{orderDetail.mobile}}</text>
<view class="area sm m-t-10 lighter">{{orderDetail.delivery_address}}</view>
</view>
<view class="address">
<view>
<text class="name md m-r-10">{{orderDetail.consignee}}</text>
<text class="phone md">{{orderDetail.mobile}}</text>
<view class="area sm m-t-10 lighter">{{orderDetail.delivery_address}}</view>
</view>
</view>
</view>
@ -179,7 +177,10 @@
<view class="order-info contain">
<view class="item flex">
<view class="title">订单编号</view>
<view class="black">{{orderDetail.order_sn}}</view>
<view class="flex">
<view class="black" >{{orderDetail.order_sn}}</view>
<view class="copy-btn" style="background: transparent;" @click="copy(orderDetail.order_sn)">复制</view>
</view>
</view>
<view class="item flex">
<view class="title">订单类型</view>
@ -318,7 +319,7 @@
methods: {
async handleExpress() {
const {code, data, msg} = await getExpress({order_id: this.id})
const {code, data, msg} = await getExpress({order_id: 510})
if (code == 1) {
this.expressStateText = data.state_text
if (data.list) {

@ -189,6 +189,10 @@
</view>
<view class="my-invite-box m-t-20 bg-white flex-col col-center">
<view class="my-invite-title sm normal">我的邀请码</view>
<view>
<image :src="wxImage" class="wxImage"></image>
</view>
<view @click="saveQrcode()" style="text-align: center; margin-top: 20rpx;font-weight: bold;">点击下载</view>
<view class="flex bold m-t-20" style="font-size: 42rpx;line-height: 30rpx">
{{userInfo.procurement.distribution_code}}
<view class="invite-copy-btn m-l-10 xxs" @click="onCopy">点击复制</view>
@ -246,7 +250,8 @@
applyDetail,
getSuperiorInfo,
getDistribution,
veryfiyDistribute
veryfiyDistribute,
makeMyWxImage
} from "@/api/user";
import area from '@/utils/area'
import {mapGetters} from 'vuex';
@ -287,7 +292,8 @@
showRegion: false,
regionLists: area,
distributionInfo: {},
fileList:[]
fileList:[],
wxImage: ''
};
},
onLoad(options) {
@ -295,9 +301,17 @@
this.getSuperiorInfoFun()
// 判断是否是分销会员
this.veryfiyDistributeFun()
// 获取二维码
this.handleMakeMyWxImage()
},
methods: {
async handleMakeMyWxImage() {
const {code, msg, data} = await makeMyWxImage()
if (code == 1) {
this.wxImage = data.wx_image
}
},
// 上传手持身份证
uploadHandCard() {
uni.chooseImage({
@ -473,6 +487,49 @@
});
},
saveQrcode() {
// #ifndef H5
uni.showLoading({title: '正在下载……'});
uni.downloadFile({
url: this.wxImage,
success: (res) => {
if (res.statusCode === 200) {
//隐藏加载框
uni.hideLoading();
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
uni.showToast({
icon: 'none',
mask: true,
title: '文件已保存',
duration: 3000
});
},
fail: function() {
console.log('保存失败');
}
});
}
},
fail: function() {
uni.showToast({
icon: 'none',
mask: true,
title: '失败请重新下载'
});
}
})
// #endif
// #ifdef H5
this.$toast({
title: '请长按图片保存'
})
// #endif
},
// 原版本 填写邀请码
// bindSuperiorFun() {
// bindSuperior({
@ -807,5 +864,10 @@
border-radius: 10rpx;
margin-top: 60rpx;
}
.wxImage {
width: 320rpx;
height: 320rpx;
margin-top: 40rpx;
}
</style>

@ -6,7 +6,7 @@
<view class="name">商家名称</view>
<view class="flex pay">
<view class="m-r-20">¥</view>
<input class="pay-money" v-model="money" type="number" placeholder="请输入支付金额"
<input class="pay-money" v-model="money" type="digit" placeholder="请输入支付金额"
placeholder-style="font-size:28rpx;color: #6c757d;font-weight:normal;">
</view>
</view>
@ -59,12 +59,31 @@
</view>
</view>
</view>
<!-- 支付成功 -->
<u-popup class="pay-popup" v-model="successPopup" closeable round mode="center">
<view class="content bg-white">
<image class="img-icon" src="https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/icon_success.png"></image>
<view class="xxl bold m-t-10">成功支付¥{{payMoney}}</view>
<button class="br60 btn" type="primary" size="md" @tap="onShowSuccessPopup">好的</button>
</view>
</u-popup>
<!-- 取消支付 -->
<u-popup class="pay-popup" v-model="cancelPopup" closeable round mode="center">
<view class="content bg-white">
<image class="img-icon" src="https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/icon_fail.png"></image>
<view class="xxl bold m-t-10">您已取消支付</view>
<button class="br60 btn" type="primary" size="md" @tap="onShowFailPopup">好的</button>
</view>
</u-popup>
</view>
</template>
<script>
import {prepay} from '@/api/app'
import {localShopPay} from '@/api/user.js'
import {wxpay} from '@/utils/pay'
import {localShopPay, localShopLogin} from '@/api/user.js'
export default {
data() {
return {
@ -73,61 +92,89 @@
paywayList: [
{id: 1, icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/butie.png', name: '百亿返补', extra: '购买商品参与百亿返补', pay_way: 1},
{id: 2, icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/bazhe.png', name: '八折支付', extra: '购买商品享受八折服务', pay_way: 2},
]
],
user_id: 0,
successPopup: false,
cancelPopup: false,
payMoney: 0
};
},
onLoad(options) {
console.log('options=', options)
},
onUnload() {
this.login()
},
methods: {
async login() {
const that = this
const [err,res] = await uni.login()
if (err) {
this.$toast({ title: "登录失败" })
return
}
if (res) {
const {code, data} = await localShopLogin({code: res.code, invite_code: 'L74Y93'})
if (code == 1) {
this.user_id = data.user_id
}
}
},
changePayway(e) {
console.log(e)
},
// 微信预支付处理
handlePrepay() {
localShopPay().then((result) => {
console.log('result=', result)
if (this.user_id <= 0) {
this.$toast({ title: "请重新扫码登录" })
return
}
// const invite_code = 'L74Y93'
localShopPay({
user_id: this.user_id
}).then((result) => {
if (result.code == 1) {
const pay = {
nonceStr: result.data.noncestr,
package: result.data.package,
paySign: result.data.sign,
signType: result.data.signType,
timeStamp: result.data.timestamp,
}
this.handleWechatPay(pay);
}
})
// if (this.loadingPay) return
// this.loadingPay = true
// prepay({
// from: this.from,
// order_id: this.order_id,
// pay_way: 1, // 微信支付
// p_id: this.$store.getters.hasPid,
// set: this.$store.getters.hasSetId
// }).then(({ code, data }) => {
// switch(code) {
// case 1:
// this.handleWechatPay(data);
// break;
// case 10001:
// this.handleAlipayPay(data);
// break;
// case 20001:
// this.handleWalletPay();
// break;
// case 20002:
// this.handleCreditPat();
// break;
// }
// }).catch(err => {
// }).finally(() => {
// setTimeout(() => {
// this.loadingPay = false
// }, 500)
// })
},
},
watch: {
// 微信支付
handleWechatPay(data) {
wxpay(data).then(res => {
this.handPayResult(res)
}).catch(err => {
})
},
// 支付后处理
handPayResult(result) {
this.payMoney = this.money
this.money = ''
if (result === 'success') {
this.successPopup = true
} else if (result === 'fail') {
this.cancelPopup = true
}
},
onShowSuccessPopup() {
this.successPopup = !this.successPopup
},
onShowFailPopup() {
this.cancelPopup = !this.cancelPopup
}
}
}
</script>
@ -204,4 +251,23 @@
}
}
}
.pay-popup {
.content {
padding: 40rpx 0;
text-align: center;
width: 560rpx;
border-radius: 20rpx;
}
.img-icon {
width: 112rpx;
height: 112rpx;
display: inline-block;
}
.btn {
margin: 80rpx 60rpx 0;
}
}
</style>

@ -322,15 +322,6 @@
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/express_details/index",
"meta": {
"auth": true
},
"style": {
"navigationBarTitleText": "物流详情"
}
},
{
"path": "pages/user_address/user_address",
"meta": {

@ -19,6 +19,9 @@
import {
strToParams
} from '@/utils/tools'
import {
bindSuperior
} from '@/api/user'
import {
getLevelOneList,
getGoodsList,
@ -53,6 +56,16 @@
let data = strToParams(decodeURIComponent(query.scene))
this.p_id = data.id ? parseInt(data.id) : 0;
this.set = data.set ? parseInt(data.set) : 0;
if (data.icde) {
const [err,res] = await uni.login()
if (err) {
this.$toast({ title: "登录失败" })
return
}
if (res) {
await bindSuperior({code: res.code, invite_code: data.icde})
}
}
}
}
this.$store.commit("setPid", this.p_id);