2.2提交
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<view class="label">邮箱</view>
|
||||
<input class="input" v-model="email" type="text" placeholder="用于接收电子卡等信息(可选)" />
|
||||
</view> -->
|
||||
<view class="divider-line"></view>
|
||||
|
||||
|
||||
<view class="form-item select-item" @click="openAreaPicker">
|
||||
<view class="label">地址</view>
|
||||
@@ -34,6 +34,7 @@
|
||||
<view class="label">详细地址</view>
|
||||
<input class="input" v-model="detail" placeholder="请输入街道、门牌等详细地址信息" />
|
||||
</view>
|
||||
<view class="divider-line"></view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="footer-bar" @click="submit">
|
||||
@@ -63,28 +64,29 @@
|
||||
</view>
|
||||
</view>
|
||||
<unidialog
|
||||
:title="'确认收货信息'"
|
||||
:title="'确认兑换信息'"
|
||||
:visible="freeVisible"
|
||||
:content="freeContent"
|
||||
:titleColor="'#000'"
|
||||
@close="freeClose"
|
||||
@confirm="freeConfirm"
|
||||
>
|
||||
<template #content>
|
||||
<view>
|
||||
<view class="row">
|
||||
<view class="left">收件人:</view>
|
||||
<view class="left">收件人:</view>
|
||||
<view class="right">{{ receiver }}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">手机号:</view>
|
||||
<view class="left">手机号:</view>
|
||||
<view class="right">{{ mobile }}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">地址:</view>
|
||||
<view class="left">地址:</view>
|
||||
<view class="right">{{ regionText+detail }}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">兑换积分:</view>
|
||||
<view class="left">兑换积分:</view>
|
||||
<view class="right"><text class="price">0积分</text>(包邮)</view>
|
||||
</view>
|
||||
<view class="row">请确认此次兑换,物品不退不换</view>
|
||||
@@ -102,6 +104,7 @@ import unidialog from '@/components/dialog/dialog.vue';
|
||||
const freeVisible = ref(false)
|
||||
const freeContent = ref('')
|
||||
const goods_order_id = ref('')
|
||||
import navTo from '@/utils/navTo';
|
||||
const freeClose = () => {
|
||||
freeVisible.value = false
|
||||
}
|
||||
@@ -112,11 +115,21 @@ const freeConfirm = () => {
|
||||
type: 5
|
||||
}).then(res => {
|
||||
if(res.code == 1 || res.code == 200){
|
||||
uni.sendNativeEvent('goTabbarPage', {
|
||||
msg: 'mine'
|
||||
},ret => {
|
||||
console.log(ret);
|
||||
})
|
||||
|
||||
uni.showToast({
|
||||
title: '兑换成功',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
navTo({
|
||||
url: '/pages_goods/myRedemption/myRedemption?from=upan'
|
||||
});
|
||||
}, 1000);
|
||||
// uni.sendNativeEvent('goTabbarPage', {
|
||||
// msg: 'mine'
|
||||
// },ret => {
|
||||
// console.log(ret);
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -198,13 +211,36 @@ onLoad((opts) => {
|
||||
console.log(opts);
|
||||
goodsUuid.value = opts.goodsUuid
|
||||
goodsNum.value = opts.goodsNum
|
||||
getAddress()
|
||||
})
|
||||
|
||||
const saveAddress = () => {
|
||||
uni.setStorageSync('goods_address', {
|
||||
receiver: receiver.value,
|
||||
mobile: mobile.value,
|
||||
regionText: regionText.value,
|
||||
detail: detail.value,
|
||||
email: email.value
|
||||
})
|
||||
}
|
||||
const getAddress = () => {
|
||||
const address = uni.getStorageSync('goods_address')
|
||||
if(address){
|
||||
receiver.value = address.receiver
|
||||
mobile.value = address.mobile
|
||||
regionText.value = address.regionText
|
||||
detail.value = address.detail
|
||||
email.value = address.email
|
||||
}
|
||||
}
|
||||
|
||||
const submit = () => {
|
||||
|
||||
if (!receiver.value) return uni.showToast({ title: '请输入收件人', icon: 'none' })
|
||||
if (!/^1\d{10}$/.test(mobile.value)) return uni.showToast({ title: '请输入正确手机号', icon: 'none' })
|
||||
if (!regionText.value) return uni.showToast({ title: '请选择地址', icon: 'none' })
|
||||
if (!detail.value) return uni.showToast({ title: '请输入详细地址', icon: 'none' })
|
||||
saveAddress();
|
||||
api.createGoodsOrder({
|
||||
goodsUuid: goodsUuid.value,
|
||||
goodsNum: goodsNum.value,
|
||||
@@ -216,6 +252,7 @@ const submit = () => {
|
||||
if(res.code == 1 || res.code == 200){
|
||||
freeVisible.value = true
|
||||
goods_order_id.value = res.data.goods_order_id
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -228,7 +265,7 @@ const submit = () => {
|
||||
.form-item { display: flex; align-items: center; padding: 24rpx; }
|
||||
.label { width: 160rpx; color: #333; font-size: 30rpx; }
|
||||
.input { flex: 1; color: #333; font-size: 30rpx; }
|
||||
.placeholder { color: #bbb; }
|
||||
.placeholder { color: #808080;}
|
||||
.divider-line { height: 2rpx; background: #eee; margin: 0 24rpx; }
|
||||
.select-item { position: relative; }
|
||||
.arrow { position: absolute; right: 24rpx; color: #999; font-size: 48rpx; }
|
||||
@@ -247,15 +284,16 @@ const submit = () => {
|
||||
.picker-empty { padding: 40rpx; text-align: center; color: #999; }
|
||||
.row{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
font-size: 28rpx;
|
||||
padding: 12rpx 0;
|
||||
|
||||
max-width: 800rpx;
|
||||
margin-left: -100rpx;
|
||||
|
||||
.left{
|
||||
text-align: left;
|
||||
max-width: 125rpx;
|
||||
max-width: 142rpx;
|
||||
white-space: nowrap;
|
||||
width:auto!important;
|
||||
}
|
||||
.price{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<!-- 商品信息卡片 -->
|
||||
<view class="product-card">
|
||||
<!-- 商品描述 -->
|
||||
<view class="product-title">超实用~肝胆相照知识U盘(2026年版)</view>
|
||||
<view class="product-title">{{ goodsInfo.name }}</view>
|
||||
|
||||
<!-- 兑换信息 -->
|
||||
<view class="exchange-info">
|
||||
@@ -52,15 +52,16 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import navBar from '@/components/navBar/navBar.vue';
|
||||
import api from '@/api/api';
|
||||
import goods_api from '@/api/goods_api';
|
||||
import navTo from '@/utils/navTo';
|
||||
const goodsUuid = ref('');
|
||||
|
||||
|
||||
// 商品信息
|
||||
const remainingCount = ref(2); // 剩余数量
|
||||
const remainingCount = ref(0); // 剩余数量
|
||||
const exchangedCount = ref(1129); // 已兑换数量
|
||||
const quantity = ref(1); // 当前选择的数量
|
||||
const goodsInfo = ref({});
|
||||
@@ -71,7 +72,12 @@
|
||||
quantity.value += 1;
|
||||
}
|
||||
};
|
||||
|
||||
const getUpanCount = async () => {
|
||||
const res = await goods_api.getUpanWelfareCount()
|
||||
if (res.code == 200) {
|
||||
remainingCount.value=res.data;
|
||||
};
|
||||
}
|
||||
// 减少数量
|
||||
const decreaseQuantity = () => {
|
||||
if (quantity.value > 1) {
|
||||
@@ -89,13 +95,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (quantity.value > remainingCount.value) {
|
||||
uni.showToast({
|
||||
title: '兑换数量不能超过剩余数量',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (quantity.value > remainingCount.value) {
|
||||
// uni.showToast({
|
||||
// title: '兑换数量不能超过剩余数量',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// TODO: 调用兑换接口
|
||||
navTo({
|
||||
@@ -111,6 +117,7 @@
|
||||
// 根据实际接口返回的数据结构更新
|
||||
console.log(33);
|
||||
console.log(res.data);
|
||||
goodsInfo.value = res.data;
|
||||
if (res.data) {
|
||||
//remainingCount.value = res.data.remainingCount;
|
||||
exchangedCount.value = res.data.times;
|
||||
@@ -122,10 +129,12 @@
|
||||
});
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
remainingCount.value = options.restNum;
|
||||
onShow((options) => {
|
||||
//remainingCount.value = options.restNum;
|
||||
// 可选:获取实时剩余数量
|
||||
//getUGoods();
|
||||
getUpanWelfareCount();
|
||||
getUpanCount();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -162,14 +171,11 @@
|
||||
// 为底部按钮留出空间
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: 40rpx 30rpx;
|
||||
}
|
||||
|
||||
// 商品信息卡片
|
||||
.product-card {
|
||||
background-color: $white;
|
||||
border-radius: 16rpx;
|
||||
|
||||
padding: 40rpx 30rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
@@ -186,7 +192,7 @@
|
||||
font-size: 28rpx;
|
||||
|
||||
.info-left {
|
||||
color: $text-secondary;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.info-right {
|
||||
|
||||
Reference in New Issue
Block a user