From ab9cd2c82bd64de8e33510db1d1e78a5b3b4de70 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期一, 20 四月 2026 19:37:20 +0800
Subject: [PATCH] 代码生成
---
small-program/pages/luggage-storage/luggage-storage.vue | 550 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 388 insertions(+), 162 deletions(-)
diff --git a/small-program/pages/luggage-storage/luggage-storage.vue b/small-program/pages/luggage-storage/luggage-storage.vue
index 7eb1422..101c289 100644
--- a/small-program/pages/luggage-storage/luggage-storage.vue
+++ b/small-program/pages/luggage-storage/luggage-storage.vue
@@ -18,18 +18,18 @@
<view class="page-content">
<view v-if="activeMode === 'local'" class="service-point-card cell-card" @click="openStorePopup">
<view class="cell-left with-icon">
- <image class="cell-icon" src="/static/icon/ic_store@2x.png" mode="widthFix"></image>
- <view class="store-cell-copy">
- <text class="cell-title">{{ selectedStore ? selectedStore.name : servicePointPlaceholder }}</text>
- <view class="store-cell-copy-addr">
- <image src="/static/icon/home_ic_location3@2x.png" mode="widthFix"></image>
- <text v-if="selectedStore" class="store-cell-subtitle">{{ selectedStore.address }}</text>
+ <image class="cell-icon" src="/static/icon/ic_store@2x.png" mode="widthFix"></image>
+ <view class="store-cell-copy">
+ <text class="cell-title">{{ selectedStore ? selectedStore.name : servicePointPlaceholder }}</text>
+ <view class="store-cell-copy-addr" v-if="selectedStore">
+ <image src="/static/icon/home_ic_location3@2x.png" mode="widthFix"></image>
+ <text class="store-cell-subtitle">{{ selectedStore.address }}</text>
+ </view>
</view>
</view>
- </view>
- <view class="cell-right">
- <u-icon name="arrow-right" size="22" color="#222222"></u-icon>
- </view>
+ <view class="cell-right">
+ <u-icon name="arrow-right" size="18" color="#222222"></u-icon>
+ </view>
</view>
<view v-else class="address-card section-card">
@@ -62,27 +62,49 @@
</view>
<view class="form-row">
<text class="form-label">鏀朵欢浜�</text>
- <input v-model="form.receiver" class="form-input" :class="{ 'filled-input': form.receiver }" type="text" placeholder="璇疯緭鍏ユ敹浠朵汉濮撳悕" placeholder-style="color: #B2B2B2;" placeholder-class="input-placeholder" />
+ <input v-model="form.receiver" class="form-input" :class="{ 'filled-input': form.receiver }" type="text" placeholder="璇疯緭鍏ユ敹浠朵汉濮撳悕" placeholder-style="color: #B2B2B2;" />
</view>
<view class="form-row no-border">
<text class="form-label">鏀朵欢鐢佃瘽</text>
- <input v-model="form.mobile" class="form-input" :class="{ 'filled-input': form.mobile }" type="number" placeholder="璇疯緭鍏ユ敹浠朵汉鐢佃瘽" placeholder-style="color: #B2B2B2;" placeholder-class="input-placeholder" />
+ <input v-model="form.mobile" class="form-input" :class="{ 'filled-input': form.mobile }" type="number" placeholder="璇疯緭鍏ユ敹浠朵汉鐢佃瘽" placeholder-style="color: #B2B2B2;" />
</view>
<view class="form-row dashed-row">
<text class="form-label">棰勮鍒板簵鏃堕棿</text>
- <view class="row-picker">
+ <view class="row-picker" @click="showArriveTimePicker = true">
<text :class="form.arriveTime ? 'picker-value-text' : 'placeholder-text'">{{ form.arriveTime || '璇烽�夋嫨' }}</text>
<u-icon name="arrow-right" size="18" color="#222222"></u-icon>
</view>
</view>
<view class="form-row no-border">
<text class="form-label">棰勮鍙栦欢鏃堕棿</text>
- <view class="row-picker">
+ <view class="row-picker" @click="showPickupTimePicker = true">
<text :class="form.pickupTime ? 'picker-value-text' : 'placeholder-text'">{{ form.pickupTime || '璇烽�夋嫨' }}</text>
<u-icon name="arrow-right" size="18" color="#222222"></u-icon>
</view>
</view>
</view>
+ <u-datetime-picker
+ :show="showArriveTimePicker"
+ v-model="arriveTimeValue"
+ mode="datetime"
+ confirmText="纭畾"
+ cancelText="鍙栨秷"
+ title="閫夋嫨棰勮鍒板簵鏃堕棿"
+ @confirm="confirmArriveTime"
+ @cancel="showArriveTimePicker = false"
+ @close="showArriveTimePicker = false"
+ ></u-datetime-picker>
+ <u-datetime-picker
+ :show="showPickupTimePicker"
+ v-model="pickupTimeValue"
+ mode="datetime"
+ confirmText="纭畾"
+ cancelText="鍙栨秷"
+ title="閫夋嫨棰勮鍙栦欢鏃堕棿"
+ @confirm="confirmPickupTime"
+ @cancel="showPickupTimePicker = false"
+ @close="showPickupTimePicker = false"
+ ></u-datetime-picker>
<view class="section-card luggage-card">
<view class="section-head between">
@@ -96,53 +118,43 @@
</view>
</view>
<view
- v-for="item in luggageTypes"
- :key="item.id"
+ v-for="(item, index) in luggageTypes"
+ :key="index"
class="luggage-item"
- :class="{ active: luggageCountMap[item.id] > 0 }"
- @tap="selectLuggage(item.id)"
+ :class="{ active: item.count > 0 }"
>
<view class="luggage-info">
- <image class="luggage-image" src="" mode="aspectFit"></image>
+ <image class="luggage-image" :src="item.iconFull" mode="widthFix"></image>
<view class="luggage-copy">
<text class="luggage-name">{{ item.name }}</text>
- <text class="luggage-size">{{ item.size }}</text>
+ <text class="luggage-size">{{ item.otherField || '' }}</text>
</view>
</view>
- <view v-if="luggageCountMap[item.id] > 0" class="luggage-stepper" @tap.stop>
- <view class="step-btn" @tap="decreaseCount(item.id)">
- <u-icon name="minus" size="18" color="#B9C0C9"></u-icon>
- </view>
- <text class="step-count">{{ luggageCountMap[item.id] }}</text>
- <view class="step-btn active" @tap="increaseCount(item.id)">
- <u-icon name="plus" size="18" color="#FFFFFF"></u-icon>
- </view>
- </view>
- <view v-else class="luggage-stepper add-only" @tap.stop>
- <view class="step-btn active" @tap="increaseCount(item.id)">
- <u-icon name="plus" size="18" color="#FFFFFF"></u-icon>
- </view>
+ <view class="luggage-stepper">
+ <image class="step-btn" src="/static/icon/ic_jian@2x.png" mode="widthFix" @click="decreaseCount(index)"></image>
+ <text class="step-count">{{ item.count }}</text>
+ <image class="step-btn" src="/static/icon/ic_jia@2x.png" mode="widthFix" @click="increaseCount(index)"></image>
</view>
</view>
</view>
- <view class="section-card goods-card" @tap="openGoodsPopup">
- <view class="section-head between arrow-head">
+ <view class="section-card goods-card">
+ <view class="section-head between arrow-head" @click="showGoodsPopup = true">
<view>
<text class="section-title">鐗╁搧淇℃伅</text>
</view>
<view class="required-wrap">
- <text class="section-required goods-required-text">{{ selectedGoodsText }}</text>
- <u-icon name="arrow-right" size="18" color="#A8AFBA"></u-icon>
+ <text class="section-required goods-required-text" :style="{ color: form.goodTypeName ? '#111111' : '#B2B2B2' }">{{ form.goodTypeName || '蹇呴�夛紝璇烽�夋嫨' }}</text>
+ <u-icon name="arrow-right" size="12" color="#A8AFBA"></u-icon>
</view>
</view>
<view class="goods-upload-row">
- <view class="upload-box">
+ <view class="upload-box" @click="chooseAndUploadImage(9)">
<image class="upload-icon" src="/static/image/btn_upload@2x.png" mode="widthFix"></image>
</view>
- <view v-for="(item, index) in uploadedImages" :key="index" class="uploaded-box">
+ <view v-for="(item, index) in uploadedImages" :key="index" class="uploaded-box" @click="deleteImage(index)">
<image class="uploaded-image" :src="item.url" mode="aspectFill"></image>
- <text class="uploaded-delete">鍒犻櫎</text>
+ <text class="uploaded-delete" @click="deleteImage(index)">鍒犻櫎</text>
</view>
</view>
</view>
@@ -201,16 +213,16 @@
</view>
<view class="store-search-bar">
<image class="store-search-icon" src="/static/icon/ic_search2@2x.png" mode="widthFix"></image>
- <input v-model="storeKeyword" class="store-search-input" type="text" placeholder="鎼滅储鏈嶅姟鐐瑰悕绉�" placeholder-class="store-search-placeholder" />
+ <input v-model="storeForm.keyword" class="store-search-input" type="text" @confirm="searchStore" placeholder="鎼滅储鏈嶅姟鐐瑰悕绉�" placeholder-class="store-search-placeholder" />
</view>
- <scroll-view scroll-y class="store-list-scroll">
- <view
- v-for="item in filteredStores"
- :key="item.id"
- class="store-option"
- :class="{ active: tempSelectedStoreId === item.id }"
- @tap="tempSelectedStoreId = item.id"
- >
+ <scroll-view scroll-y class="store-list-scroll" @scrolltolower="getNearbyShopList">
+ <view
+ v-for="(item, index) in storeList"
+ :key="index"
+ class="store-option"
+ :class="{ active: item.active }"
+ @click="storeList.forEach((row,i) => row.active = index === i)"
+ >
<view class="store-option-main">
<image class="store-thumb" src="" mode="aspectFill"></image>
<view class="store-option-copy">
@@ -255,11 +267,11 @@
<text class="goods-popup-desc">涓虹‘淇濈墿鍝佸瘎閫掑畨鍏紝璇锋鏌ユ槸鍚︿笉澶瑰甫鏄撶噧鏄撶垎鐗╁搧</text>
<view class="goods-tag-grid">
<view
- v-for="item in goodsOptions"
- :key="item.id"
+ v-for="(item, index) in goodsOptions"
+ :key="index"
class="goods-tag"
- :class="{ active: tempSelectedGoodsIds.includes(item.id) }"
- @tap="toggleGoods(item.id)"
+ :class="{ active: item.active }"
+ @click="goodsOptions.forEach((row,i) => row.active = i === index)"
>
<text>{{ item.name }}</text>
</view>
@@ -277,12 +289,12 @@
</view>
</view>
<view class="amount-popup-content">
- <view v-for="item in amountDetails" :key="item.label" class="amount-row">
+ <view v-for="(item, index) in amountData.itemList" :key="index" class="amount-row">
<view class="amount-row-left">
- <text class="amount-row-label">{{ item.label }}</text>
- <text v-if="item.count" class="amount-row-count">x{{ item.count }}</text>
+ <text class="amount-row-label">{{ item.categoryName }}</text>
+ <text v-if="item.quantity" class="amount-row-count">x{{ item.quantity }}</text>
</view>
- <text class="amount-row-value">{{ item.value }}</text>
+ <text class="amount-row-value">{{ '锟�' + item.unitPrice }}</text>
</view>
</view>
<view class="agreement-bar popup-agreement-bar">
@@ -295,11 +307,11 @@
<view class="bottom-action-row popup-action-row">
<view class="total-wrap">
<text class="total-label">鎬昏垂鐢�</text>
- <text class="total-price">锟�150.00</text>
+ <text class="total-price">{{ amountData ? '锟�' + amountData.totalPrice : '锟�--' }}</text>
<text class="detail-text">鏄庣粏</text>
- <u-icon name="arrow-up" size="18" color="#7B7F86"></u-icon>
+ <u-icon name="arrow-up" size="13" color="#7B7F86"></u-icon>
</view>
- <view class="submit-btn active-submit-btn">绔嬪嵆涓嬪崟</view>
+ <view class="submit-btn active-submit-btn" @click="createOrder">绔嬪嵆涓嬪崟</view>
</view>
</view>
</u-popup>
@@ -315,107 +327,81 @@
<view class="bottom-action-row">
<view class="total-wrap">
<text class="total-label">鎬昏垂鐢�</text>
- <text class="total-price">{{ totalPriceText }}</text>
+ <text class="total-price">{{ amountData ? '锟�' + amountData.totalPrice : '锟�--' }}</text>
<text class="detail-text detail-click" @tap.stop="openAmountPopup">鏄庣粏</text>
<u-icon name="arrow-down" size="18" color="#999999"></u-icon>
</view>
- <view class="submit-btn active-submit-btn">绔嬪嵆涓嬪崟</view>
+ <view class="submit-btn active-submit-btn" @click="createOrder">绔嬪嵆涓嬪崟</view>
</view>
</view>
</view>
</template>
<script>
+ import { mapState } from 'vuex'
export default {
data() {
return {
showStorePopup: false,
showGoodsPopup: false,
showAmountPopup: false,
+ showArriveTimePicker: false,
+ showPickupTimePicker: false,
+ arriveTimeValue: Number(new Date()),
+ pickupTimeValue: Number(new Date()),
activeMode: 'local',
modeTabs: [
{ label: '灏卞湴瀵勫瓨', value: 'local' },
{ label: '鍚屽煄瀵勯��', value: 'city' }
],
agreementChecked: true,
- storeKeyword: '',
tempSelectedStoreId: 2,
selectedStoreId: 2,
tempSelectedGoodsIds: [1],
selectedGoodsIds: [1],
selectedLuggageId: 1,
selectedServiceTime: 1,
- luggageCountMap: {
- 1: 1,
- 2: 1,
- 3: 0
- },
form: {
- receiver: '钄″瓙鐟�',
- mobile: '18166525368',
- arriveTime: '2026-04-15 16:30',
- pickupTime: '2026-04-17 16:30',
- insurance: '200',
- remark: ''
+ receiver: '',
+ mobile: '',
+ arriveTime: '',
+ pickupTime: '',
+ goodType: '',
+ goodTypeName: '',
+ insurance: '',
+ remark: '',
+ goodsImages: [],
},
- luggageTypes: [
- { id: 1, name: '澶т欢琛屾潕绠�', size: '24-28瀵�' },
- { id: 2, name: '涓欢琛屾潕绠�', size: '24-28瀵�' },
- { id: 3, name: '灏忎欢琛屾潕绠�', size: '24-28瀵�' }
- ],
+ amountData: null,
+ luggageTypes: [],
serviceTimes: [
{ id: 1, name: '鏍囧噯杈�(棰勮6灏忔椂鍐呴�佽揪)', price: '锟�50' },
{ id: 2, name: '鎬ラ�熻揪(棰勮4灏忔椂鍐呴�佽揪)', price: '锟�70' }
],
- storeList: [
- { id: 1, name: '涓搧蹇繍鍗楃珯鏃楄埌搴�', address: '鍚堣偉鍗楃珯璐熶竴灞�100鍙�', time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00', distance: '239m' },
- { id: 2, name: '涓搧蹇繍鍚堣偉鐏溅绔�', address: '鍚堣偉鐏溅绔欎竴灞�12鍙�', time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00', distance: '12.8km' },
- { id: 3, name: '鍚堣偉鐏溅绔欏寳骞垮満', address: '鍚堣偉鐏溅绔欎竴灞�12鍙�', time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00', distance: '13.1km' },
- { id: 4, name: '灏忛搧鏃犲咖瀛�', address: '鍚堣偉鐏溅绔欎竴灞�12鍙�', time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00', distance: '16.3km' },
- { id: 5, name: '涓搧蹇繍鍚堣偉鐏溅绔�', address: '鍚堣偉鐏溅绔欎竴灞�12鍙�', time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00', distance: '20.8km' }
- ],
- goodsOptions: [
- { id: 1, name: '鏂囦欢' },
- { id: 2, name: '琛f湇' },
- { id: 3, name: '婊戦洩鏉�' },
- { id: 4, name: '鍙戠エ' },
- { id: 5, name: '鎵嬫満' },
- { id: 6, name: '鐢佃剳' },
- { id: 7, name: '闉嬪瓙' },
- { id: 8, name: '鎶よ偆鍝�' },
- { id: 9, name: '鐧介厭' },
- { id: 10, name: '闉嬪瓙' },
- { id: 11, name: '鎶よ偆鍝�' },
- { id: 12, name: '鐧介厭' },
- { id: 13, name: '闉嬪瓙' },
- { id: 14, name: '鎶よ偆鍝�' },
- { id: 15, name: '鐧介厭' }
- ],
- amountDetails: [
- { label: '澶т欢琛屾潕绠�', count: 1, value: '锟�35' },
- { label: '涓欢琛屾潕绠�', count: 1, value: '锟�35' },
- { label: '瀵勫瓨澶╂暟', count: '', value: '2澶�' },
- { label: '琛屾潕淇濅环', count: '', value: '锟�10' }
- ],
- uploadedImages: [
- { url: '/static/icon/nav_home_sel@2x.png' },
- { url: '/static/icon/nav_xingcheng_sel@2x.png' }
- ]
+
+ storeList: [],
+ selectedStore: null,
+ storeForm: {
+ keyword: '',
+ page: 1,
+ isSearch: true
+ },
+
+ goodsOptions: [],
+ uploadedImages: []
+ }
+ },
+ watch: {
+ 'form.insurance': {
+ handler() {
+ this.calculateLocalPrice()
+ }
}
},
computed: {
- selectedStore() {
- return this.storeList.find(item => item.id === this.selectedStoreId) || null
- },
+ ...mapState(['latitude', 'longitude', 'cityId']),
servicePointPlaceholder() {
return this.activeMode === 'city' ? '閫夋嫨瀵勯�佹湇鍔$偣' : '閫夋嫨瀵勫瓨鏈嶅姟鐐�'
- },
- filteredStores() {
- const keyword = (this.storeKeyword || '').trim()
- if (!keyword) {
- return this.storeList
- }
- return this.storeList.filter(item => item.name.includes(keyword) || item.address.includes(keyword))
},
selectedGoodsText() {
if (!this.selectedGoodsIds.length) {
@@ -436,7 +422,101 @@
return '锟�150.00'
}
},
+ onLoad() {
+ this.getNearbyShopList()
+ this.getCategoryList()
+ this.getCitySizeList()
+ },
methods: {
+ async uploadFiles(filePaths, maxCount = 9) {
+ if (!filePaths || filePaths.length === 0) {
+ return []
+ }
+ const limitedPaths = filePaths.slice(0, maxCount)
+ const uploadTasks = limitedPaths.map(filePath => {
+ return new Promise((resolve, reject) => {
+ uni.uploadFile({
+ url: this.$baseUrl + '/web/public/upload',
+ filePath: filePath,
+ name: 'file',
+ formData: {
+ folder: 'orders'
+ },
+ success: (res) => {
+ if (res.statusCode === 200) {
+ const data = JSON.parse(res.data)
+ if (data.code === 200) {
+ resolve(data.data)
+ } else {
+ reject(new Error(data.msg || '涓婁紶澶辫触'))
+ }
+ } else {
+ reject(new Error('涓婁紶澶辫触'))
+ }
+ },
+ fail: (err) => {
+ reject(err)
+ }
+ })
+ })
+ })
+ try {
+ const results = await Promise.all(uploadTasks)
+ return results
+ } catch (error) {
+ uni.showToast({
+ title: '涓婁紶澶辫触',
+ icon: 'none'
+ })
+ throw error
+ }
+ },
+ deleteImage(index) {
+ this.uploadedImages.splice(index, 1)
+ this.form.goodsImages.splice(index, 1)
+ },
+ async chooseAndUploadImage(maxCount = 9) {
+ const currentCount = this.form.goodsImages.length
+ const remainingCount = maxCount - currentCount
+ if (remainingCount <= 0) {
+ uni.showToast({
+ title: `鏈�澶氫笂浼�${maxCount}寮犲浘鐗嘸,
+ icon: 'none'
+ })
+ return
+ }
+ uni.chooseImage({
+ count: remainingCount,
+ sizeType: ['compressed'],
+ sourceType: ['album', 'camera'],
+ success: async (res) => {
+ const tempFilePaths = res.tempFilePaths
+ uni.showLoading({
+ title: '涓婁紶涓�...',
+ mask: true
+ })
+ try {
+ const uploadResults = await this.uploadFiles(tempFilePaths, maxCount)
+ const fullPaths = uploadResults.map(item => item.url || item.path || item)
+ this.uploadedImages = [...this.uploadedImages, ...fullPaths.map(url => ({ url }))]
+ this.form.goodsImages = [...this.form.goodsImages, ...fullPaths]
+ uni.hideLoading()
+ uni.showToast({
+ title: '涓婁紶鎴愬姛',
+ icon: 'success'
+ })
+ } catch (error) {
+ uni.hideLoading()
+ }
+ }
+ })
+ },
+ searchStore() {
+ this.storeList = []
+ this.storeForm.page = 1
+ this.storeForm.isSearch = true
+ this.getNearbyShopList()
+ },
switchMode(mode) {
this.activeMode = mode
},
@@ -450,41 +530,187 @@
this.showAmountPopup = true
},
openStorePopup() {
- this.tempSelectedStoreId = this.selectedStoreId
+ this.tempSelectedStoreId = null
this.showStorePopup = true
},
confirmStore() {
- this.selectedStoreId = this.tempSelectedStoreId
+ this.selectedStore = this.storeList.find(item => item.active)
this.showStorePopup = false
- },
- openGoodsPopup() {
- this.tempSelectedGoodsIds = [...this.selectedGoodsIds]
- this.showGoodsPopup = true
- },
- toggleGoods(id) {
- if (this.tempSelectedGoodsIds.includes(id)) {
- this.tempSelectedGoodsIds = this.tempSelectedGoodsIds.filter(item => item !== id)
- return
- }
- this.tempSelectedGoodsIds = [...this.tempSelectedGoodsIds, id]
+ this.calculateLocalPrice()
},
confirmGoods() {
- this.selectedGoodsIds = [...this.tempSelectedGoodsIds]
+ this.form.goodTypeName = this.goodsOptions.find(item => item.active)?.name || ''
+ this.form.goodType = this.goodsOptions.find(item => item.active)?.id || ''
this.showGoodsPopup = false
},
- selectLuggage(id) {
- this.selectedLuggageId = id
+ confirmArriveTime(e) {
+ const date = new Date(e.value)
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+ const hour = String(date.getHours()).padStart(2, '0')
+ const minute = String(date.getMinutes()).padStart(2, '0')
+ this.form.arriveTime = `${year}-${month}-${day} ${hour}:${minute}`
+ this.showArriveTimePicker = false
+ this.calculateLocalPrice()
},
- increaseCount(id) {
- const current = this.luggageCountMap[id] || 0
- this.$set(this.luggageCountMap, id, current + 1)
+ confirmPickupTime(e) {
+ const date = new Date(e.value)
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+ const hour = String(date.getHours()).padStart(2, '0')
+ const minute = String(date.getMinutes()).padStart(2, '0')
+ this.form.pickupTime = `${year}-${month}-${day} ${hour}:${minute}`
+ this.showPickupTimePicker = false
+ this.calculateLocalPrice()
},
- decreaseCount(id) {
- const current = this.luggageCountMap[id] || 0
- if (current <= 0) {
+ // 鐗╁搧鍒嗙被
+ async getCategoryList() {
+ const res = await this.$u.api.getCategoryList({ type: 2 })
+ if (res.code === 200) {
+ res.data.forEach(item => {
+ item.active = false
+ })
+ this.goodsOptions = res.data || []
+ }
+ },
+ async getCitySizeList() {
+ const res = await this.$u.api.getCitySizeList({ cityId: this.cityId })
+ if (res.code === 200) {
+ res.data.forEach(item => {
+ item.count = 0
+ })
+ this.luggageTypes = res.data || []
+ }
+ },
+ async getNearbyShopList() {
+ if (!this.storeForm.isSearch) return;
+ const res = await this.$u.api.getNearbyShopList({
+ capacity: 10,
+ page: this.storeForm.page,
+ model: {
+ latitude: this.latitude,
+ longitude: this.longitude,
+ cityId: this.cityId,
+ sortType: 1
+ }
+ })
+ if (res.code === 200) {
+ res.data.records.forEach(item => {
+ item.active = false
+ })
+ this.storeList = [...this.storeList, ...res.data.records || []]
+ this.storeForm.page++
+ this.storeForm.isSearch = this.storeList.length <= res.data.total
+ }
+ },
+ increaseCount(index) {
+ this.luggageTypes[index].count++
+ this.calculateLocalPrice()
+ },
+ decreaseCount(index) {
+ if (this.luggageTypes[index].count > 0) {
+ this.luggageTypes[index].count--
+ }
+ this.calculateLocalPrice()
+ },
+ async calculateLocalPrice() {
+ if (!this.selectedStore || !this.form.arriveTime || !this.form.pickupTime) {
return
}
- this.$set(this.luggageCountMap, id, current - 1)
+ const luggageList = this.luggageTypes
+ .filter(item => item.count > 0)
+ .map(item => ({
+ categoryId: item.id,
+ quantity: item.count
+ }))
+ if (luggageList.length === 0) {
+ return
+ }
+ const res = await this.$u.api.calculateLocalPrice({
+ cityId: this.cityId,
+ shopId: this.selectedStore.id,
+ depositStartTime: this.form.arriveTime + ':00',
+ depositEndTime: this.form.pickupTime + ':00',
+ items: luggageList,
+ declaredAmount: this.form.insurance || 0
+ })
+ if (res.code === 200) {
+ res.data.itemList.forEach(item => {
+ item.unitPrice = item.unitPrice / 100
+ })
+ res.data.totalPrice = res.data.totalPrice / 100
+ this.amountData = res.data
+ }
+ },
+ async createOrder() {
+ if (!this.selectedStore) {
+ uni.showToast({ title: '璇烽�夋嫨闂ㄥ簵', icon: 'none' })
+ return
+ }
+ if (!this.form.arriveTime) {
+ uni.showToast({ title: '璇烽�夋嫨棰勮鍒板簵鏃堕棿', icon: 'none' })
+ return
+ }
+ if (!this.form.pickupTime) {
+ uni.showToast({ title: '璇烽�夋嫨棰勮鍙栦欢鏃堕棿', icon: 'none' })
+ return
+ }
+ const luggageList = this.luggageTypes
+ .filter(item => item.count > 0)
+ .map(item => ({
+ categoryId: item.id,
+ quantity: item.count
+ }))
+ if (luggageList.length === 0) {
+ uni.showToast({ title: '璇烽�夋嫨琛屾潕绫诲瀷', icon: 'none' })
+ return
+ }
+ const items = luggageList.map(item => ({
+ categoryId: item.categoryId,
+ quantity: item.quantity
+ }))
+ const res = await this.$u.api.createOrder({
+ cityId: this.cityId,
+ declaredAmount: this.form.insurance || 0,
+ depositShopId: this.selectedStore.id,
+ expectedDepositTime: this.form.arriveTime + ':00',
+ expectedTakeTime: this.form.pickupTime + ':00',
+ goodType: this.form.goodType,
+ goodsImages: this.form.goodsImages,
+ items: items,
+ remark: this.form.remark,
+ takePhone: this.form.mobile,
+ takeUser: this.form.receiver,
+ type: this.activeMode === 'local' ? 0 : 1
+ })
+ if (res.code === 200) {
+ uni.showToast({ title: '涓嬪崟鎴愬姛', icon: 'success' })
+ if (res.data) {
+ this.processPayment(res.data.response)
+ }
+ }
+ },
+ processPayment(paymentData) {
+ uni.requestPayment({
+ provider: 'wxpay',
+ timeStamp: paymentData.timeStamp || '',
+ nonceStr: paymentData.nonceStr || '',
+ package: paymentData.packageValue || '',
+ signType: paymentData.signType || 'MD5',
+ paySign: paymentData.paySign || '',
+ success: (res) => {
+ uni.showToast({ title: '鏀粯鎴愬姛', icon: 'success' })
+ },
+ fail: (err) => {
+ if (err.errMsg.includes('cancel')) {
+ uni.showToast({ title: '宸插彇娑堟敮浠�', icon: 'none' })
+ } else {
+ uni.showToast({ title: '鏀粯澶辫触', icon: 'none' })
+ }
+ }
+ })
}
}
}
@@ -617,6 +843,7 @@
.store-list-scroll {
max-height: 70vh;
+ min-height: 50vh;
margin-top: 30rpx;
}
@@ -777,6 +1004,11 @@
font-size: 30rpx;
color: #222222;
line-height: 1.3;
+ }
+
+ .cell-title.placeholder {
+ color: #9097a3;
+ font-weight: 400;
}
.store-cell-subtitle {
@@ -1035,17 +1267,8 @@
}
.step-btn {
- width: 36rpx;
- height: 36rpx;
- border-radius: 18rpx;
- background: #eef1f5;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .step-btn.active {
- background: #27aef8;
+ width: 44rpx;
+ height: 44rpx;
}
.step-count {
@@ -1065,6 +1288,7 @@
.goods-upload-row {
display: flex;
align-items: center;
+ flex-wrap: wrap;
gap: 12rpx;
margin-top: 8rpx;
}
@@ -1088,12 +1312,14 @@
left: 0;
right: 0;
bottom: 0;
- height: 28rpx;
- line-height: 28rpx;
+ height: 40rpx;
+ line-height: 40rpx;
text-align: center;
- font-size: 18rpx;
- color: #ffffff;
- background: rgba(0, 0, 0, 0.48);
+ font-weight: 400;
+ font-size: 24rpx;
+ color: #FFFFFF;
+ background: rgba(0,0,0,0.5);
+ border-radius: 0rpx 0rpx 8rpx 8rpx;
}
.service-time-card {
--
Gitblit v1.9.3