feat(share): 分享注册流程完善,添加邮费逻辑,分享列表tab区分专区

This commit is contained in:
woody 2025-09-17 16:08:28 +08:00
parent 8d221af93d
commit faffc3ccd5
5 changed files with 346 additions and 174 deletions

View File

@ -12,13 +12,13 @@ export default {
} }
const whiteList = [ const whiteList = [
'pages/shareRegist/index', 'pages/shareRegist/index',
// 'pages/shareRegist/success', 'pages/shareRegist/success',
'pages/login/index', 'pages/login/index',
// 'pages/wechatPay/bfPay/', // 'pages/wechatPay/bfPay/',
// 'pages/wechatPay/hfPay/', // 'pages/wechatPay/hfPay/',
// 'pages/shareArea/hiList', 'pages/shareArea/hiList',
// 'pages/shareArea/hiOrder', 'pages/shareArea/hiOrder',
// 'pages/pay/hiPay' 'pages/pay/hiPay',
] ]
if (whiteList.indexOf(options.path) !== -1) return if (whiteList.indexOf(options.path) !== -1) return
this.$store.dispatch('GetInfo') this.$store.dispatch('GetInfo')

View File

@ -1,15 +1,15 @@
<template> <template>
<view> <view>
<u-picker @cancel='pickershow=false' <u-picker
:show="pickershow" @cancel="pickershow = false"
ref="uPicker" :show="pickershow"
:defaultIndex="defaultIndex" ref="uPicker"
:columns="columns" :defaultIndex="defaultIndex"
@confirm="confirm" :columns="columns"
keyName='name' @confirm="confirm"
@change="changeHandler"></u-picker> keyName="name"
@change="changeHandler"
></u-picker>
</view> </view>
</template> </template>
@ -43,7 +43,9 @@ export default {
if (this.cityList.length > 0) { if (this.cityList.length > 0) {
this.getDefaultIndex(n) this.getDefaultIndex(n)
} else { } else {
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry).then((res) => { this.getAllAreaList(
uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
).then(res => {
if (res) { if (res) {
this.getDefaultIndex(n) this.getDefaultIndex(n)
} }
@ -54,14 +56,16 @@ export default {
}, },
created() { created() {
this.user = uni.getStorageSync('User') this.user = uni.getStorageSync('User')
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry) this.getAllAreaList(
uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
)
}, },
methods: { methods: {
getDefaultIndex(arr) { getDefaultIndex(arr) {
let a = this.provinceList.findIndex((item) => item.pkId == arr[0]) let a = this.provinceList.findIndex(item => item.pkId == arr[0])
let b = this.cityList[a].arrList.findIndex((item) => item.pkId == arr[1]) let b = this.cityList[a].arrList.findIndex(item => item.pkId == arr[1])
let c = this.quList.findIndex((item) => item.pkId == arr[1]) let c = this.quList.findIndex(item => item.pkId == arr[1])
let d = this.quList[c].arrList.findIndex((item) => item.pkId == arr[2]) let d = this.quList[c].arrList.findIndex(item => item.pkId == arr[2])
this.columns = [ this.columns = [
this.provinceList, this.provinceList,
this.cityList[a].arrList, this.cityList[a].arrList,
@ -83,9 +87,9 @@ export default {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
api api
.getAllAreaList({ .getAllAreaList({
pkCountry: pkCountry, pkCountry: pkCountry || 1,
}) })
.then((res) => { .then(res => {
this.provinceList = res.data.provinceList this.provinceList = res.data.provinceList
// //
let cityList = [] let cityList = []
@ -138,7 +142,7 @@ export default {
if (columnIndex === 0) { if (columnIndex === 0) {
picker.setColumnValues(1, this.cityList[indexs[0]].arrList) picker.setColumnValues(1, this.cityList[indexs[0]].arrList)
let arr = [] let arr = []
this.quList.forEach((item) => { this.quList.forEach(item => {
if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) { if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) {
arr = item.arrList arr = item.arrList
} }
@ -147,7 +151,7 @@ export default {
// pickerthis // pickerthis
} else if (columnIndex === 1) { } else if (columnIndex === 1) {
let arr = [] let arr = []
this.quList.forEach((item) => { this.quList.forEach(item => {
if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) { if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) {
arr = item.arrList arr = item.arrList
} }
@ -186,4 +190,4 @@ export default {
border-radius: 4px; border-radius: 4px;
padding: 6px 9px; padding: 6px 9px;
} }
</style> </style>

View File

@ -117,3 +117,7 @@ export const energyShop = params =>
//hi粉确认订单 //hi粉确认订单
export const energyShopSilo = params => export const energyShopSilo = params =>
http.post('/sale/api/order/valid-silo', params) http.post('/sale/api/order/valid-silo', params)
// 分享注册确认订单页面获取邮费
export const getSharePostage = params =>
http.post('/sale/api/retail-order/query-reg-order-postage', params)

View File

@ -1,15 +1,18 @@
<template> <template>
<view class="contain"> <view class="contain">
<!-- 头部营销区域 --> <!-- Tab选项卡 -->
<view class="header-section"> <view class="tab-container">
<view class="hero-content"> <view class="tab-wrapper">
<view class="hero-title"> <view
<text class="hero-main">新人专享特惠</text> v-for="tab in tabs"
<text class="hero-sub">精选好物·品质优选</text> :key="tab.value"
class="tab-item"
:class="{ 'tab-active': activeTab === tab.value }"
@click="switchTab(tab.value)"
>
<text class="tab-text">{{ tab.label }}</text>
<view class="tab-line" v-if="activeTab === tab.value"></view>
</view> </view>
<!-- <view class="promotion-banner">
<text class="promo-text">限时优惠·新人福利</text>
</view> -->
</view> </view>
</view> </view>
@ -30,15 +33,41 @@
<view class="goodList_ib"> <view class="goodList_ib">
<view class="price-container"> <view class="price-container">
<!-- <text class="currency"></text> --> <!-- <text class="currency"></text> -->
<text class="price">{{ <text class="price">{{ formatCurrency(item.waresPrice) }}</text>
item.waresPrice | numberToCurrency <text v-if="item.isSale === 1" class="sale-status">已售罄</text>
}}</text>
</view> </view>
<!-- <img @click.stop="addCar(item)" <!-- <img @click.stop="addCar(item)"
src="@/static/images/cart.png" src="@/static/images/cart.png"
alt=""> --> alt=""> -->
</view> </view>
<view class="toBuy" @click.stop="goBuy(item)">立即购买</view>
<!-- 数量控制区域 -->
<view class="quantity-section" v-if="item.isSale !== 1">
<view class="quantity-control">
<view
class="quantity-btn minus"
:class="{ disabled: item.quantity <= 1 }"
@click.stop="updateQuantity(item, -1)"
>
<text class="quantity-icon"></text>
</view>
<view class="quantity-display">
<text class="quantity-text">{{ item.quantity || 1 }}</text>
</view>
<view
class="quantity-btn plus"
@click.stop="updateQuantity(item, 1)"
>
<text class="quantity-icon">+</text>
</view>
</view>
<view class="toBuy" @click.stop="goBuy(item)">购买</view>
</view>
<!-- 禁售状态 -->
<view class="sold-out-section" v-if="item.isSale === 1">
<view class="sold-out-btn">暂时缺货</view>
</view>
</view> </view>
</view> </view>
<view class="list-bottom"> <view class="list-bottom">
@ -52,6 +81,7 @@
<script> <script>
import * as api from '@/config/login.js' import * as api from '@/config/login.js'
import { setToken } from '@/config/auth.js' import { setToken } from '@/config/auth.js'
import { formatCurrency } from '@/util/index.js'
export default { export default {
data() { data() {
@ -59,22 +89,25 @@ export default {
pkParent: '', pkParent: '',
goodList: [], goodList: [],
placeParent: '', placeParent: '',
activeTab: 41, //
tabs: [
{
label: '精品专区',
value: 41,
},
{
label: '商城专区',
value: 43,
},
],
} }
}, },
filters: {
seles(value) {
if (value > 999) {
return 999 + '+'
} else {
return value
}
},
},
onLoad(options) { onLoad(options) {
this.pkParent = options.pkParent this.pkParent = options.pkParent
this.getToken() this.getToken()
}, },
methods: { methods: {
formatCurrency,
getToken() { getToken() {
api api
.autoLogin({ .autoLogin({
@ -97,15 +130,35 @@ export default {
api api
.queryWares({ .queryWares({
shareMemberCode: this.pkParent, shareMemberCode: this.pkParent,
specialArea: this.activeTab,
}) })
.then(res => { .then(res => {
this.goodList = res.data // quantity
this.goodList = res.data.map(item => ({
...item,
quantity: item.quantity || 1,
}))
}) })
}, },
switchTab(value) {
if (this.activeTab !== value) {
this.activeTab = value
this.goodList = [] //
this.getList() //
}
},
updateQuantity(item, change) {
const newQuantity = (item.quantity || 1) + change
if (newQuantity >= 1) {
// 使Vue.set
this.$set(item, 'quantity', newQuantity)
}
},
goBuy(item) { goBuy(item) {
const params = { const params = {
...item, ...item,
pkParent: this.pkParent, pkParent: this.pkParent,
specialArea: this.activeTab,
} }
uni.navigateTo({ uni.navigateTo({
url: '/pages/shareArea/hiOrder?allData=' + JSON.stringify(item), url: '/pages/shareArea/hiOrder?allData=' + JSON.stringify(item),
@ -117,88 +170,60 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.contain { .contain {
background: linear-gradient( background: #f8fafc;
135deg,
#005bac 0%,
#0066cc 50%,
#f5f7fa 50%,
#e8f4f8 100%
);
min-height: 100vh; min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
// // Tab
.header-section { .tab-container {
background: linear-gradient(135deg, #005bac 0%, #0066cc 100%); background: #ffffff;
padding: 50rpx 32rpx 60rpx; padding: 20rpx 24rpx 0;
animation: slideDown 0.6s ease-out; position: relative;
z-index: 4;
.hero-content { .tab-wrapper {
text-align: center; display: flex;
justify-content: center;
position: relative;
.hero-title { .tab-item {
margin-bottom: 24rpx; flex: none;
.hero-main {
display: block;
color: #fff;
font-size: 40rpx;
font-weight: 700;
margin-bottom: 8rpx;
animation: fadeInUp 0.8s ease-out 0.2s both;
}
.hero-sub {
display: block;
color: rgba(255, 255, 255, 0.9);
font-size: 26rpx;
font-weight: 400;
animation: fadeInUp 0.8s ease-out 0.4s both;
}
}
.promotion-banner {
background: linear-gradient(
135deg,
#ff6b35 0%,
#f7931e 50%,
#ffd700 100%
);
border-radius: 30rpx;
padding: 18rpx 36rpx;
box-shadow: 0 8rpx 24rpx rgba(255, 107, 53, 0.4);
animation:
fadeInUp 0.8s ease-out 0.6s both,
promoBreathe 3s ease-in-out infinite 1s;
position: relative; position: relative;
overflow: hidden; cursor: pointer;
border: 2rpx solid rgba(255, 255, 255, 0.3); margin: 0 32rpx;
padding: 16rpx 0;
&::after { .tab-text {
content: ''; font-size: 30rpx;
position: absolute; font-weight: 500;
top: 0; color: #9ca3af;
left: -100%; transition: all 0.3s ease;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.4),
transparent
);
animation: shimmer 2.5s ease-in-out infinite;
} }
.promo-text { .tab-line {
color: #fff; position: absolute;
font-size: 28rpx; bottom: 0;
font-weight: 700; left: 0;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); right: 0;
position: relative; height: 3rpx;
z-index: 2; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
border-radius: 2rpx;
animation: slideIn 0.3s ease;
}
&.tab-active {
.tab-text {
color: #1f2937;
font-weight: 600;
}
}
&:active {
.tab-text {
transform: scale(0.95);
}
} }
} }
} }
@ -208,12 +233,9 @@ export default {
.goods-container { .goods-container {
flex: 1; flex: 1;
background: #f8fafc; background: #f8fafc;
border-radius: 40rpx 40rpx 0 0; padding: 24rpx 24rpx 0;
margin-top: -40rpx;
position: relative; position: relative;
z-index: 3; z-index: 3;
padding: 32rpx 24rpx 0;
animation: fadeIn 0.8s ease-out 0.3s both;
.section-title { .section-title {
text-align: center; text-align: center;
@ -244,18 +266,19 @@ export default {
.goodList_i { .goodList_i {
display: flex; display: flex;
background: #ffffff; background: #ffffff;
border-radius: 20rpx; border-radius: 24rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
padding: 24rpx; padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 91, 172, 0.06); box-shadow: 0 4rpx 20rpx rgba(102, 126, 234, 0.08);
border: 1rpx solid rgba(0, 91, 172, 0.1); border: 1rpx solid rgba(102, 126, 234, 0.08);
transition: all 0.3s ease; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
animation: slideInUp 0.6s ease-out both; animation: slideInUp 0.6s ease-out both;
opacity: 0; opacity: 0;
&:hover { &:hover {
transform: translateY(-4rpx); transform: translateY(-6rpx);
box-shadow: 0 12rpx 32rpx rgba(0, 91, 172, 0.15); box-shadow: 0 16rpx 40rpx rgba(102, 126, 234, 0.2);
border-color: rgba(102, 126, 234, 0.15);
} }
.cover { .cover {
@ -300,6 +323,7 @@ export default {
.price-container { .price-container {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
justify-content: space-between;
.currency { .currency {
color: #ff6b35; color: #ff6b35;
@ -313,6 +337,16 @@ export default {
font-size: 36rpx; font-size: 36rpx;
font-weight: 700; font-weight: 700;
} }
.sale-status {
color: #ef4444;
font-size: 24rpx;
font-weight: 500;
background: rgba(239, 68, 68, 0.1);
padding: 4rpx 12rpx;
border-radius: 12rpx;
border: 1rpx solid rgba(239, 68, 68, 0.2);
}
} }
img { img {
@ -321,18 +355,106 @@ export default {
} }
} }
//
.quantity-section {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
.quantity-control {
display: flex;
align-items: center;
background: #f8fafc;
border-radius: 20rpx;
border: 1rpx solid #e2e8f0;
overflow: hidden;
.quantity-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
transition: all 0.2s ease;
cursor: pointer;
.quantity-icon {
font-size: 32rpx;
font-weight: 600;
color: #667eea;
}
&.minus {
&.disabled {
opacity: 0.3;
cursor: not-allowed;
.quantity-icon {
color: #9ca3af;
}
}
}
&:not(.disabled):active {
background: #f1f5f9;
transform: scale(0.95);
}
}
.quantity-display {
min-width: 80rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
border-left: 1rpx solid #e2e8f0;
border-right: 1rpx solid #e2e8f0;
.quantity-text {
font-size: 28rpx;
font-weight: 600;
color: #1f2937;
}
}
}
}
//
.sold-out-section {
display: flex;
justify-content: flex-end;
.sold-out-btn {
background: #f3f4f6;
color: #9ca3af;
padding: 16rpx 32rpx;
text-align: center;
border-radius: 12rpx;
font-size: 24rpx;
font-weight: 500;
border: 1rpx solid #e5e7eb;
cursor: not-allowed;
}
}
.toBuy { .toBuy {
background: #005bac; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #ffffff; color: #ffffff;
padding: 20rpx 0; padding: 16rpx 24rpx;
text-align: center; text-align: center;
border-radius: 12rpx; border-radius: 12rpx;
font-size: 28rpx; font-size: 24rpx;
font-weight: 600; font-weight: 600;
border: none; border: none;
transition: all 0.3s ease; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
box-shadow: 0 2rpx 8rpx rgba(102, 126, 234, 0.2);
flex-shrink: 0;
min-width: 120rpx;
&::before { &::before {
content: ''; content: '';
@ -351,9 +473,9 @@ export default {
} }
&:hover { &:hover {
background: #0066cc; background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
transform: translateY(-2rpx); transform: translateY(-1rpx);
box-shadow: 0 6rpx 16rpx rgba(0, 91, 172, 0.3); box-shadow: 0 4rpx 12rpx rgba(102, 126, 234, 0.3);
&::before { &::before {
left: 100%; left: 100%;
@ -361,7 +483,7 @@ export default {
} }
&:active { &:active {
transform: scale(0.98); transform: scale(0.95) translateY(0);
} }
} }
} }
@ -379,6 +501,17 @@ export default {
} }
// //
@keyframes slideIn {
from {
transform: scaleX(0);
opacity: 0;
}
to {
transform: scaleX(1);
opacity: 1;
}
}
@keyframes slideDown { @keyframes slideDown {
from { from {
opacity: 0; opacity: 0;
@ -477,19 +610,24 @@ export default {
// //
@media (max-width: 750rpx) { @media (max-width: 750rpx) {
.header-section { .tab-container {
padding: 40rpx 24rpx 50rpx; padding: 24rpx 16rpx 0;
.hero-content { .tab-wrapper {
.hero-title .hero-main { .tab-item {
font-size: 36rpx; margin: 0 24rpx;
padding: 12rpx 0;
.tab-text {
font-size: 28rpx;
}
} }
} }
} }
.goodList { .goodList {
.goodList_i { .goodList_i {
padding: 20rpx; padding: 24rpx;
.cover { .cover {
width: 200rpx; width: 200rpx;
@ -511,9 +649,39 @@ export default {
} }
} }
.quantity-section {
.quantity-control {
.quantity-btn {
width: 50rpx;
height: 50rpx;
.quantity-icon {
font-size: 28rpx;
}
}
.quantity-display {
min-width: 70rpx;
height: 50rpx;
.quantity-text {
font-size: 24rpx;
}
}
}
}
.toBuy { .toBuy {
padding: 18rpx 0; padding: 14rpx 20rpx;
font-size: 26rpx; font-size: 22rpx;
min-width: 100rpx;
}
.sold-out-section {
.sold-out-btn {
padding: 14rpx 28rpx;
font-size: 22rpx;
}
} }
} }
} }

View File

@ -163,7 +163,7 @@
<view class="disFlex justBwn"> <view class="disFlex justBwn">
<view class="tit3">{{ '金额小计' }}</view> <view class="tit3">{{ '金额小计' }}</view>
<view class="tit1">{{ <view class="tit1">{{
allData.waresPrice | numberToCurrency (allData.waresPrice * allData.quantity) | numberToCurrency
}}</view> }}</view>
</view> </view>
</view> </view>
@ -178,7 +178,7 @@
<view class="footer_l"> <view class="footer_l">
<view class="disFlex"> <view class="disFlex">
<view class="h1">总价</view> <view class="h1">总价</view>
<view class="r1">{{ allData.waresPrice | numberToCurrency }}</view> <view class="r1">{{ totalPrice | numberToCurrency }}</view>
</view> </view>
<!-- <view class="disFlex"> <!-- <view class="disFlex">
<view class="h1">{{'业绩'}}</view> <view class="h1">{{'业绩'}}</view>
@ -325,7 +325,6 @@ export default {
this.allData this.allData
) )
this.placeParent = uni.getStorageSync('placeParent') this.placeParent = uni.getStorageSync('placeParent')
this.allData.quantity = 1
this.setGoodlistType() this.setGoodlistType()
this.getGenerate() this.getGenerate()
this.getCountry() this.getCountry()
@ -333,24 +332,18 @@ export default {
// this.getDeliveryList() // this.getDeliveryList()
}, },
onShow() {}, onShow() {},
methods: { computed: {
getRegiestLevel() { totalPrice() {
const params = { return (
firstCheck: 0, this.allData.waresPrice * this.allData.quantity +
specialArea: this.specialArea, Number(this.form.postage)
shopList: this.shoppingArr.map(id => { )
return {
shoppingId: id,
}
}),
}
}, },
},
methods: {
regionSelectHandle() { regionSelectHandle() {
this.$refs.regionAddress.setShow(this.provinceList[0].pkId) this.$refs.regionAddress.setShow(this.provinceList[0].pkId)
}, },
setRegionAddress(area) {
this.regionAddress = area
},
phonePass(rule, value, callback) { phonePass(rule, value, callback) {
if (!value) { if (!value) {
callback(new Error('请输入联系电话')) callback(new Error('请输入联系电话'))
@ -393,12 +386,18 @@ export default {
this.isCountry = true this.isCountry = true
this.countryIndex = index this.countryIndex = index
}, },
getPostage() {
api
.getSharePostage({
specialArea: this.allData.specialArea,
waresList: this.waresList,
...this.form,
})
.then(res => {
this.form.postage = res.data.postage
})
},
sureCountry(e) { sureCountry(e) {
console.log(
'%c [ e ]-418',
'font-size:13px; background:#b131b9; color:#f575fd;',
e
)
const { value } = e const { value } = e
this.form.pkCountry = value[0].id this.form.pkCountry = value[0].id
this.form.pkCountryLabel = value[0].label this.form.pkCountryLabel = value[0].label
@ -423,6 +422,7 @@ export default {
.fansConfirm( .fansConfirm(
Object.assign({}, this.form, { Object.assign({}, this.form, {
waresList: this.waresList, waresList: this.waresList,
specialArea: this.allData.specialArea,
}) })
) )
.then(res => { .then(res => {
@ -437,15 +437,10 @@ export default {
}, },
setGoodlistType() { setGoodlistType() {
let carList = { let carList = {
quantity: 1, quantity: this.allData?.quantity || 1,
pkWares: this.allData.pkId, pkWares: this.allData.pkId,
skuList: [], skuList: [],
} }
console.log(
'%c [ carList ]-419',
'font-size:13px; background:#b131b9; color:#f575fd;',
this.allData
)
this.allData.productGroup.forEach(item => { this.allData.productGroup.forEach(item => {
carList.skuList.push({ carList.skuList.push({
pkWaresSku: item.pkSkuId, pkWaresSku: item.pkSkuId,
@ -464,6 +459,7 @@ export default {
this.form.recProvince = obj.province this.form.recProvince = obj.province
this.form.recCity = obj.city this.form.recCity = obj.city
this.form.recCounty = obj.county this.form.recCounty = obj.county
this.getPostage()
this.$forceUpdate() this.$forceUpdate()
// this.setGoodlistType() // this.setGoodlistType()
// this.queryAdressPostage() // this.queryAdressPostage()