feat:抖音支付

This commit is contained in:
2026-09-09 11:46:36 +08:00
parent 75060faa39
commit b350f1c07a
18 changed files with 2670 additions and 531 deletions
@@ -1,32 +1,18 @@
<template>
<view class="address_add_warp">
<Header
:leftTitle="titleText"
leftPath="1"
/>
<Header :leftTitle="titleText" leftPath="1" />
<view class="address_form">
<view class="add_form_item add_form_item_but">
<view class="add_form_title">收货人</view>
<up-input
placeholder="收货人"
border="surround"
v-model="form.name"
:customStyle="{
border: '0rpx',
}"
></up-input>
<up-input placeholder="收货人" border="surround" v-model="form.name" :customStyle="{
border: '0rpx',
}"></up-input>
</view>
<view class="add_form_item add_form_item_but">
<view class="add_form_title">手机号码</view>
<up-input
placeholder="请填写收货人手机号"
border="surround"
v-model="form.mobile"
:customStyle="{
border: '0rpx',
}"
type="number"
></up-input>
<up-input placeholder="请填写收货人手机号" border="surround" v-model="form.mobile" :customStyle="{
border: '0rpx',
}" type="number" maxlength="11"></up-input>
</view>
<view class="add_form_item add_form_item_but">
<view class="add_form_title">所在地区</view>
@@ -34,25 +20,15 @@
<view style="color: #808080; margin-left: 22rpx; font-size: 28rpx">{{
(form.regionStr && form.regionStr.join("/")) || "所在地区"
}}</view>
<up-image
src="/static/common/right_soild.png"
width="14"
height="14"
bgColor="#f1f6ff00"
></up-image>
<up-image src="/static/common/right_soild.png" width="14" height="14" bgColor="#f1f6ff00"></up-image>
</view>
</view>
<view class="add_form_item">
<view class="add_form_title">详细地址</view>
<up-input
placeholder="门牌号、小区、楼栋号、单元室等"
border="surround"
v-model="form.address"
:customStyle="{
border: '0rpx',
height: '100rpx',
}"
></up-input>
<up-input placeholder="门牌号、小区、楼栋号、单元室等" border="surround" v-model="form.address" :customStyle="{
border: '0rpx',
height: '100rpx',
}"></up-input>
</view>
</view>
<!-- <view class="address_default">
@@ -78,10 +54,10 @@
@cancel="regionShow = false"
@close="regionShow = false"
></up-picker> -->
<AddressPopup @ok="onOk"
:show="regionShow" @itemSelect="onItemSelect" @select="onSelect" :curSelect="curSelect" :selectList="curSelectList" :dataList="addressList" @close="onClose"></AddressPopup>
<qiaobao-assistant page-key="pages/mine_package/mine_address_add/mine_address_add" title="编辑收货地址" />
</view>
<AddressPopup @ok="onOk" :show="regionShow" @itemSelect="onItemSelect" @select="onSelect" :curSelect="curSelect"
:selectList="curSelectList" :dataList="addressList" @close="onClose"></AddressPopup>
<qiaobao-assistant page-key="pages/mine_package/mine_address_add/mine_address_add" title="编辑收货地址" />
</view>
</template>
<script>
@@ -91,10 +67,10 @@ import AddressPopup from '@/components/common/address-popup.vue'
import Header from "@/components/header.vue";
export default {
components: { Header,AddressPopup },
components: { Header, AddressPopup },
data() {
return {
titleText:'添加地址',
titleText: '添加地址',
form: {
id: 0,
name: null, // 收货人
@@ -108,9 +84,9 @@ export default {
address: null, // 详细地址
},
regionShow: false,
curSelect:-1,
addressList:[],
curSelectList:[],
curSelect: -1,
addressList: [],
curSelectList: [],
regionColumns: [],
regionLoading: false,
// leftPath: "/pages/mine_package/mine_address/mine_address",
@@ -122,81 +98,81 @@ export default {
const detail = option.detail;
if (id && id !== 0) {
this.getById(id);
this.titleText = '修改地址';
this.titleText = '修改地址';
}
},
methods: {
onItemSelect(item,xItem){
this.curSelectList.push(xItem);
this.curSelect++;
this.getAddressList(xItem.id).then(() => {
if (!this.addressList.length) {
this.onOk();
}
});
},
onSelect(item,index){
this.curSelectList.splice(index + 1);
this.curSelect = index;
this.getAddressList(this.curSelectList[this.curSelectList.length - 1].id);
},
async getAddressList(id = 0){
const params = {
parentId: id,
};
const resp = await getCascadeRegion(params);
if (resp.bizcode === 100) {
this.addressList = [];
resp.data.forEach(item=>{
if(this.addressList.length){
let index = this.addressList.findIndex(i=>i.zi == item.firstLetter);
if(index != -1){
this.addressList[index].data.push({id:item.id,pId:item.parentId,name:item.name});
}else{
this.addressList.push({zi:item.firstLetter,data:[{id:item.id,pId:item.parentId,name:item.name}]});
}
}else{
this.addressList.push({zi:item.firstLetter,data:[{id:item.id,pId:item.parentId,name:item.name}]});
}
})
this.addressList.sort((a,b)=>{
if (a.zi < b.zi) return -1;
if (a.zi > b.zi) return 1;
return 0;
});
}
},
onOk(){
this.form.regionStr = [];
this.curSelectList.forEach((item,index)=>{
if(index == 0){
this.form.countryId = item.id;
this.form.regionStr.push(item.name);
}else if(index == 1){
this.form.provinceId = item.id;
this.form.regionStr.push(item.name);
}else if(index == 2){
this.form.cityId = item.id;
this.form.regionStr.push(item.name);
}else if(index == 3){
this.form.areaId = item.id;
this.form.regionStr.push(item.name);
}else if(index == 4){
this.form.townshipId = item.id;
this.form.regionStr.push(item.name);
}
})
console.log('areaId',this.form)
this.onClose();
},
onClose(){
this.regionShow=false;
this.curSelect=false;
this.addressList=[];
this.curSelectList=[];
},
onItemSelect(item, xItem) {
this.curSelectList.push(xItem);
this.curSelect++;
this.getAddressList(xItem.id).then(() => {
if (!this.addressList.length) {
this.onOk();
}
});
},
onSelect(item, index) {
this.curSelectList.splice(index + 1);
this.curSelect = index;
this.getAddressList(this.curSelectList[this.curSelectList.length - 1].id);
},
async getAddressList(id = 0) {
const params = {
parentId: id,
};
const resp = await getCascadeRegion(params);
if (resp.bizcode === 100) {
this.addressList = [];
resp.data.forEach(item => {
if (this.addressList.length) {
let index = this.addressList.findIndex(i => i.zi == item.firstLetter);
if (index != -1) {
this.addressList[index].data.push({ id: item.id, pId: item.parentId, name: item.name });
} else {
this.addressList.push({ zi: item.firstLetter, data: [{ id: item.id, pId: item.parentId, name: item.name }] });
}
} else {
this.addressList.push({ zi: item.firstLetter, data: [{ id: item.id, pId: item.parentId, name: item.name }] });
}
})
this.addressList.sort((a, b) => {
if (a.zi < b.zi) return -1;
if (a.zi > b.zi) return 1;
return 0;
});
}
},
onOk() {
this.form.regionStr = [];
this.curSelectList.forEach((item, index) => {
if (index == 0) {
this.form.countryId = item.id;
this.form.regionStr.push(item.name);
} else if (index == 1) {
this.form.provinceId = item.id;
this.form.regionStr.push(item.name);
} else if (index == 2) {
this.form.cityId = item.id;
this.form.regionStr.push(item.name);
} else if (index == 3) {
this.form.areaId = item.id;
this.form.regionStr.push(item.name);
} else if (index == 4) {
this.form.townshipId = item.id;
this.form.regionStr.push(item.name);
}
})
console.log('areaId', this.form)
this.onClose();
},
onClose() {
this.regionShow = false;
this.curSelect = false;
this.addressList = [];
this.curSelectList = [];
},
/**
* 用作编辑
*/
@@ -241,41 +217,41 @@ export default {
// 选择地址的弹框
async regionShowCheck() {
this.curSelectList = [];
this.curSelect = -1;
if(this.form.townshipId){
this.curSelectList.push({id:this.form.countryId,name:this.form.regionStr[0]});
this.curSelectList.push({id:this.form.provinceId,name:this.form.regionStr[1]});
this.curSelectList.push({id:this.form.cityId,name:this.form.regionStr[2]});
this.curSelectList.push({id:this.form.areaId,name:this.form.regionStr[3]});
this.curSelectList.push({id:this.form.townshipId,name:this.form.regionStr[4]});
this.curSelect = 4;
await this.getAddressList(this.form.townshipId);
}else if(this.form.areaId){
this.curSelectList.push({id:this.form.countryId,name:this.form.regionStr[0]});
this.curSelectList.push({id:this.form.provinceId,name:this.form.regionStr[1]});
this.curSelectList.push({id:this.form.cityId,name:this.form.regionStr[2]});
this.curSelectList.push({id:this.form.areaId,name:this.form.regionStr[3]});
this.curSelect = 3;
await this.getAddressList(this.form.areaId);
}else if(this.form.cityId){
this.curSelectList.push({id:this.form.countryId,name:this.form.regionStr[0]});
this.curSelectList.push({id:this.form.provinceId,name:this.form.regionStr[1]});
this.curSelectList.push({id:this.form.cityId,name:this.form.regionStr[2]});
this.curSelect = 2;
await this.getAddressList(this.form.cityId);
}else if(this.form.provinceId){
this.curSelectList.push({id:this.form.countryId,name:this.form.regionStr[0]});
this.curSelectList.push({id:this.form.provinceId,name:this.form.regionStr[1]});
this.curSelect = 1;
await this.getAddressList(this.form.provinceId);
}else if(this.form.countryId){
this.curSelectList.push({id:this.form.countryId,name:this.form.regionStr[0]});
this.curSelect = 0;
await this.getAddressList(this.form.countryId);
}else{
await this.getAddressList();
}
this.curSelectList = [];
this.curSelect = -1;
if (this.form.townshipId) {
this.curSelectList.push({ id: this.form.countryId, name: this.form.regionStr[0] });
this.curSelectList.push({ id: this.form.provinceId, name: this.form.regionStr[1] });
this.curSelectList.push({ id: this.form.cityId, name: this.form.regionStr[2] });
this.curSelectList.push({ id: this.form.areaId, name: this.form.regionStr[3] });
this.curSelectList.push({ id: this.form.townshipId, name: this.form.regionStr[4] });
this.curSelect = 4;
await this.getAddressList(this.form.townshipId);
} else if (this.form.areaId) {
this.curSelectList.push({ id: this.form.countryId, name: this.form.regionStr[0] });
this.curSelectList.push({ id: this.form.provinceId, name: this.form.regionStr[1] });
this.curSelectList.push({ id: this.form.cityId, name: this.form.regionStr[2] });
this.curSelectList.push({ id: this.form.areaId, name: this.form.regionStr[3] });
this.curSelect = 3;
await this.getAddressList(this.form.areaId);
} else if (this.form.cityId) {
this.curSelectList.push({ id: this.form.countryId, name: this.form.regionStr[0] });
this.curSelectList.push({ id: this.form.provinceId, name: this.form.regionStr[1] });
this.curSelectList.push({ id: this.form.cityId, name: this.form.regionStr[2] });
this.curSelect = 2;
await this.getAddressList(this.form.cityId);
} else if (this.form.provinceId) {
this.curSelectList.push({ id: this.form.countryId, name: this.form.regionStr[0] });
this.curSelectList.push({ id: this.form.provinceId, name: this.form.regionStr[1] });
this.curSelect = 1;
await this.getAddressList(this.form.provinceId);
} else if (this.form.countryId) {
this.curSelectList.push({ id: this.form.countryId, name: this.form.regionStr[0] });
this.curSelect = 0;
await this.getAddressList(this.form.countryId);
} else {
await this.getAddressList();
}
this.regionShow = true;
},
// 数据交互
@@ -332,8 +308,8 @@ export default {
this.form.areaId = regionId[3] ? regionId[3] : null;
this.form.townshipId = regionId[4] ? regionId[4] : null;
}
this.regionShowCheck(false);
},
@@ -356,6 +332,13 @@ export default {
});
return;
}
if (!/^1[3-9]\d{9}$/.test(params.mobile)) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入正确的手机号码",
});
return;
}
if (!params.regionStr) {
this.$refs.uToastRef.show({
type: "error",
@@ -388,15 +371,15 @@ export default {
if (!params.countryId || params.countryId === 0) {
delete params.countryId;
}
delete params.regionStr;
if(params.countryId != 47021){
this.$refs.uToastRef.show({
type: "error",
message: '选择地址错误'
});
return;
}
if (params.countryId != 47021) {
this.$refs.uToastRef.show({
type: "error",
message: '选择地址错误'
});
return;
}
const res = await editAddress(params);
if (res && res.bizcode === 100) {
uni.$emit("refreshAddressList");
@@ -96,26 +96,25 @@
<template v-if="orderInfo.orderPackages && orderInfo.orderPackages.length > 0">
<view class="express_header_row">
<view class="express_title">运单号</view>
<view
class="express_toggle_btn"
v-if="orderInfo.orderPackages.length > 1"
@click="isExpandExpress = !isExpandExpress"
>
<text>{{ isExpandExpress ? '收起' : `展开全部(${orderInfo.orderPackages.length})` }}</text>
<u-icon :name="isExpandExpress ? 'arrow-up' : 'arrow-down'" color="#7934F6" size="12" style="margin-left: 4rpx;"></u-icon>
<view class="express_toggle_btn" v-if="orderInfo.orderPackages.length > 1"
@click="isExpandExpress = !isExpandExpress">
<text>{{ isExpandExpress ? '收起' : `展开全部(${orderInfo.orderPackages.length})`
}}</text>
<u-icon :name="isExpandExpress ? 'arrow-up' : 'arrow-down'" color="#7934F6"
size="12" style="margin-left: 4rpx;"></u-icon>
</view>
</view>
<view
class="express_item_row"
<view class="express_item_row"
v-for="(pkg, pkgIdx) in (isExpandExpress ? orderInfo.orderPackages : orderInfo.orderPackages.slice(0, 1))"
:key="pkg.id || pkgIdx"
>
:key="pkg.id || pkgIdx">
<view class="express_info_text">
<text class="express_name_tag" v-if="pkg.expressName">{{ pkg.expressName }}</text>
<text class="express_name_tag" v-if="pkg.expressName">{{ pkg.expressName
}}</text>
<text class="express_no_num">{{ pkg.expressNo }}</text>
</view>
<view class="express_copy_btn" @click="copyData(pkg.expressNo)">
<up-image src="/static/common/copy.png" width="12" height="12" bgColor="#f1f6ff00"></up-image>
<up-image src="/static/common/copy.png" width="12" height="12"
bgColor="#f1f6ff00"></up-image>
<text class="copy_text">复制</text>
</view>
</view>
@@ -130,7 +129,8 @@
<text class="express_no_num">{{ pItem.expressNo }}</text>
</view>
<view class="express_copy_btn" @click="copyData(pItem.expressNo)">
<up-image src="/static/common/copy.png" width="12" height="12" bgColor="#f1f6ff00"></up-image>
<up-image src="/static/common/copy.png" width="12" height="12"
bgColor="#f1f6ff00"></up-image>
<text class="copy_text">复制</text>
</view>
</view>
@@ -225,8 +225,8 @@
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.UNPAID" @click="goPay">去付款
</view>
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_1" style="border-color: #7732ff" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE"
@click="onExpress(orderInfo.id)">
<view class="operate_comm operate_but_1" style="border-color: #7732ff"
v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE" @click="onExpress(orderInfo.id)">
<text class="text-zi">查看物流</text>
</view>
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE"
@@ -285,6 +285,7 @@ import {
import {
appWxpayFun,
zfbPayFun,
douyinPayFun,
jumpWayOk,
jumpWayError,
} from "@/utils/payUtils.js";
@@ -358,6 +359,10 @@ export default {
let params = {
types: "1,2,3",
};
// #ifdef APP-PLUS
params.types = "1,2,3,6"
// #endif
const result = await getSupportPay(params);
if (result && result.bizcode === 100) {
const data = result.data || [];
@@ -433,6 +438,9 @@ export default {
item.alipay
) {
this.zfbPay(item.alipay, item.orderId, item.orderNum);
} else if (item.douyin && Object.keys(item.douyin).length !== 0) {
// 抖音支付
this.appDouying(item.douyin, item.orderId, item.orderNum);
} else {
this.$refs.uToastRef.show({
type: "error",
@@ -446,6 +454,18 @@ export default {
this.getOrderInfo();
}
},
// app 抖音支付
async appDouying(douyin, orderId, orderNum) {
try {
const result = await douyinPayFun(douyin, orderId, orderNum);
console.log("抖音支付发起成功", result);
// 处理支付发起成功后的逻辑
} catch (error) {
console.error("抖音支付失败", error);
// 处理支付失败后的逻辑
}
},
// app 微信支付
async appWxpay(alipay, orderId, orderNum) {
try {
@@ -457,6 +477,7 @@ export default {
// 处理支付失败后的逻辑,如提示用户等
}
},
// 支付宝支付
async zfbPay(alipay, orderId, orderNum) {
try {
+127 -15
View File
@@ -8,6 +8,8 @@
<up-image :src="`https://static.tbmall.xin/static/mine-purse/${item.categoty}.png`" width="22" height="22"
bgColor="#f1f6ff00" class="purse_amount"></up-image>
<view class="title">{{ item.name }}</view>
<up-image v-if="item.categoty != 'balance'" src="/pages/rwa_package/static/tips.png" width="16" height="16"
bgColor="#f1f6ff00" @click.stop="openTip(item.categoty)" />
<up-image src="/static/common/right_soild.png" width="10" height="10" bgColor="#fff"
class="right_soild"></up-image>
</view>
@@ -31,17 +33,20 @@
</view>
<view class="bottom_item" v-if="item.categoty == 'vcoin'">
<view class="bottom_item_amount">{{ item.bonusAmount || 0 }}</view>
<view class="bottom_item_title">消费者权益</view>
<view class="bottom_item_amount bottom_item_amount_center">{{ item.bonusAmount || 0 }}</view>
<view class="bottom_item_title bottom_item_title_center">
<text class="title_text">消费者权益</text>
<up-image v-if="item.categoty != 'balance'" src="/pages/rwa_package/static/tips.png" width="12" height="12"
bgColor="#f1f6ff00" class="tip_icon" @click.stop="openTip('rights')" />
</view>
</view>
<view class="bottom_item" @click.stop="onTip(vIndex)">
<view class="bottom_item_lock">{{ item.lockAmount || 0 }}</view>
<view class="bottom_item_title bottom_item_title_right">
<text class="title_text">{{ item.categoty === "raffle" ? "不可用次数" : "不可用余额" }}</text>
<view class="tips_icon_box" v-if="item.categoty == 'balance' || item.categoty == 'raffle'">
<up-image src="/pages/rwa_package/static/tips.png" width="12" height="12" bgColor="#fff" />
</view>
<up-image v-if="item.categoty == 'balance' || item.categoty == 'raffle'"
src="/pages/rwa_package/static/tips.png" width="12" height="12" bgColor="#fff" class="tip_icon" />
</view>
</view>
</view>
@@ -99,6 +104,17 @@
</view>
</view>
</up-popup>
<!-- 字段解释弹窗 -->
<up-popup :show="tipShow" mode="center" :round="16" @close="tipShow = false">
<view class="tip_popup_content">
<view class="tip_popup_title">字段解释</view>
<view class="tip_popup_body">
<view class="tip_subtitle">{{ currentTip.subTitle }}</view>
<view class="tip_detail">{{ currentTip.detail }}</view>
</view>
<view class="tip_popup_btn" @click="tipShow = false">我知道了</view>
</view>
</up-popup>
<qiaobao-assistant page-key="pages/mine_package/mine_purse/mine_purse" title="钱包与账户" />
</view>
</template>
@@ -111,6 +127,9 @@ import { getValue } from "@/utils/enumUtils.js";
import { formatDate, handleAmount } from "@/utils/index.js";
export default {
options: {
styleIsolation: 'shared',
},
components: { headerComponent: Header },
data() {
return {
@@ -120,6 +139,8 @@ export default {
collectShow: false,
collectSuccess: false,
availableAmount: 0,
tipShow: false,
tipCategory: "",
collectForm: {
mobile: "",
amount: "",
@@ -128,10 +149,38 @@ export default {
},
};
},
computed: {
currentTip() {
const map = {
expend: {
subTitle: "贡献值:",
detail: "购买商品确认签收后立即可获得贡献值。按毛利的1:1发放",
},
raffle: {
subTitle: "抽奖次数:",
detail: "购买商品可获得抽奖次数,抽奖次数可在抽奖活动中进行使用",
},
vcoin: {
subTitle: "数字积分:",
detail:
"根据贡献值按照比例进行转换获得1. 商城贡献值10W内的贡献值1:1转换成数字积分2. 商城贡献值10W外的根据数字积分数量和总贡献值及贡献值占比进行获得。",
},
rights: {
subTitle: "消费者权益:",
detail: "根据数字积分进行转换,根据消费者权益可获得共享计划权益",
},
};
return map[this.tipCategory] || { subTitle: "", detail: "" };
},
},
onLoad() {
this.getAcctBalance();
},
methods: {
openTip(category) {
this.tipCategory = category;
this.tipShow = true;
},
getValue,
formatDate,
handleAmount,
@@ -365,6 +414,10 @@ export default {
font-weight: bold;
font-size: 36rpx;
color: #333333;
&.bottom_item_amount_center {
text-align: center;
}
}
.bottom_item_lock {
@@ -379,6 +432,7 @@ export default {
font-size: 20rpx;
color: #999999;
display: flex;
flex-direction: row;
align-items: center;
white-space: nowrap;
@@ -386,23 +440,34 @@ export default {
justify-content: flex-end;
}
.title_text {
white-space: nowrap;
&.bottom_item_title_center {
justify-content: center;
}
.tips_icon_box {
margin-left: 8rpx;
flex-shrink: 0;
.title_text {
white-space: nowrap;
font-size: 20rpx;
color: #999999;
line-height: 1;
display: flex;
align-items: center;
}
::v-deep(.bottom_item_tip_title) {
.u-image__image {
margin-top: 8rpx;
margin-left: 8rpx;
}
::v-deep(.tip_icon),
.tip_icon {
margin-left: 8rpx;
display: flex;
align-items: center;
justify-content: center;
.u-image,
.u-image__image,
image {
display: flex !important;
align-items: center !important;
justify-content: center !important;
margin: 0 !important;
}
}
}
}
@@ -553,5 +618,52 @@ export default {
}
}
}
.tip_popup_content {
background: #ffffff;
width: 600rpx;
border-radius: 24rpx;
padding: 44rpx 36rpx;
box-sizing: border-box;
.tip_popup_title {
font-weight: 600;
font-size: 34rpx;
color: #333333;
text-align: center;
margin-bottom: 40rpx;
}
.tip_popup_body {
margin-bottom: 48rpx;
.tip_subtitle {
font-size: 28rpx;
color: #333333;
font-weight: 500;
margin-bottom: 12rpx;
}
.tip_detail {
font-size: 28rpx;
color: #333333;
line-height: 1.6;
white-space: pre-wrap;
}
}
.tip_popup_btn {
width: 100%;
height: 84rpx;
background: #707070;
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: #ffffff;
font-weight: 500;
}
}
}
</style>