From 6513c0b26da5896a462b89dbd0241aafb838f120 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 18 七月 2025 18:59:29 +0800
Subject: [PATCH] 调接口
---
small-program/pages/index/index.vue | 142 +++++++++++++++++++++++++++++++---------------
1 files changed, 95 insertions(+), 47 deletions(-)
diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index fec1ae9..880b9c9 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -11,14 +11,12 @@
<view class="search" :style="{ top: statusbarHeight + navHeight + 'px' }">
<view class="index-j-cate">
<view class="index-j-cate-item" v-for="(item, index) in searchType" :key="index" @click="clickCate(item.id)">
- <text :style="{ color: typeVal === item.id ? '##222222' : '' }">{{item.name}}</text>
+ <text :style="{ color: typeVal === item.id ? '#222222' : '', fontSize: typeVal === item.id ? '36rpx' : '', fontWeight: typeVal === item.id ? '600' : '' }">{{item.name}}</text>
<view class="index-j-cate-item-x" v-if="typeVal === item.id"></view>
</view>
</view>
<view class="index-j-search">
- <view class="index-j-search-item active">鏈�鏂板彂甯�</view>
- <view class="index-j-search-item">璺濈浼樺厛</view>
- <view class="index-j-search-item">浠锋牸浠庨珮鍒颁綆</view>
+ <view :class="sortType === item.id ? 'index-j-search-item active' : 'index-j-search-item'" v-for="(item, index) in sortList" :key="index" @click="clickSort(item.id)">{{item.name}}</view>
</view>
</view>
<view class="index-j-list">
@@ -40,31 +38,43 @@
{{item.categoryName}}锝渰{item.priceNum1}}鏂�
</view>
<view class="index-list-item-info" v-if="item.type === 0 && item.workType === 1">
- {{item.categoryName}}锝渰{item.priceNum1}}鏂�
+ {{item.categoryName}}锝渰{item.priceNum1}}浜�
</view>
<view class="index-list-item-info" v-if="item.type === 0 && item.workType === 2">
- {{item.categoryName}}锝渰{item.priceNum1}}鏂�
+ {{item.categoryName}}锝渰{item.priceNum1}}浜�
</view>
<view class="index-list-item-info" v-if="item.type === 1">
- {{item.categoryName}}锝渰{item.priceNum1}}鏂�
+ {{item.transportTypeName}} | {{item.transportNum}}{{item.transportUnit}}锝滅敤杞{item.priceNum1}}澶�
</view>
<view class="index-list-item-info" v-if="item.type === 2">
{{item.wayInfoCopy}}
</view>
- <view class="index-list-item-dz">
- <image src="/static/icon/order_ic_location@2x.png" mode="widthFix"></image>
- <text>{{item.location}}</text>
+
+ <view class="address" v-if="item.type === 1">
+ <view class="address-xian"></view>
+ <view class="address-row" v-for="(address, i) in item.wayInfo" :key="i">
+ <image src="/static/icon/ic_qidian@2x.png" mode="widthFix" v-if="i === 0"></image>
+ <image src="/static/icon/ic_jingguo@2x.png" mode="widthFix" v-else-if="i !== 0 && i !== item.wayInfo.length - 1"></image>
+ <image src="/static/icon/ic_zhongdian@2x.png" mode="widthFix" v-else-if="i === item.wayInfo.length - 1"></image>
+ <text>{{item.location}}</text>
+ </view>
</view>
- <view class="index-list-item-dz">
- <image src="/static/icon/order_ic_time@2x.png" mode="widthFix"></image>
- <text>{{item.startDate}} 鑷� {{item.endDate}}锛坽{item.priceNum1}}澶╋級</text>
- </view>
+ <template v-if="[0, 2].includes(item.type)">
+ <view class="index-list-item-dz">
+ <image src="/static/icon/order_ic_location@2x.png" mode="widthFix"></image>
+ <text>{{item.location}}</text>
+ </view>
+ <view class="index-list-item-dz">
+ <image src="/static/icon/order_ic_time@2x.png" mode="widthFix"></image>
+ <text>{{item.startDate}} 鑷� {{item.endDate}}锛坽{item.priceNum1}}澶╋級</text>
+ </view>
+ </template>
<view class="index-list-item-price">
<text>棰勪及锛�</text>
<text>楼{{item.estimatedAccount / 100}}</text>
</view>
<view class="eidt">
- <sunui-mverify @change="mverify($event, item.id)"></sunui-mverify>
+ <sunui-mverify @change="getaccept($event, item.id, index)"></sunui-mverify>
</view>
</view>
</view>
@@ -311,7 +321,7 @@
export default {
components: { sunuiMverify },
computed: {
- ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid']),
+ ...mapState(['navHeight', 'statusbarHeight','userInfo','token','openid', 'latitude', 'longitude']),
totalPrice() {
return this.form.estimatedAccount / 100
}
@@ -346,6 +356,11 @@
{ name: '鍒嗘嫞宸�', id: 1 },
{ name: '鍖呰宸�', id: 2 }
],
+ sortList: [
+ { name: '鏈�鏂板彂甯�', id: 0 },
+ { name: '璺濈浼樺厛', id: 1 },
+ { name: '浠锋牸浠庨珮鍒颁綆', id: 2 }
+ ],
car: [],
btn: require('@/static/image/btn.png'),
typeViewId: 0,
@@ -375,13 +390,15 @@
estimatedAccount: '',
price: ''
},
-
+ sortType: 0,
orderList: [],
typeVal: '',
- page: 1
+ page: 1,
+ next: true
}
},
- onLoad() {
+ async onLoad() {
+ await this.$onLaunched;
this.getCategoryLists()
this.getOrderList()
this.form.linkPhone = this.userInfo.telephone
@@ -389,29 +406,23 @@
watch: {
typeId: {
handler(news, old) {
- this.form = {
- startDate: '',
- endDate: '',
- latitude: '',
- longitude: '',
- location: '',
- locationEnd: '',
- wayInfoDTOList: [],
- workType: 0,
- categoryId: '',
- categoryName: '',
- days: '',
- locationRemark: '',
- supplement: '',
- multifileList: [],
- linkName: '',
- linkPhone: '',
- estimatedAccount: '',
- price: ''
- }
+ this.form.startDate = ''
+
+ this.form.endDate = ''
+ this.form.latitude = ''
+ this.form.longitude = ''
+ this.form.location = ''
+ this.form.locationEnd = ''
+ this.form.wayInfoDTOList = ''
+ this.form.workType = ''
+ this.form.days = ''
+ this.form.locationRemark = ''
+ this.form.supplement = ''
+ this.form.multifileList = []
+ this.form.linkName = ''
+ this.form.estimatedAccount = ''
+ this.form.price = ''
this.viewStatus = false
- this.carImage = ''
- this.carRemark = ''
}
},
orderFood: {
@@ -440,21 +451,49 @@
}
}
},
+ onReachBottom() {
+ this.getOrderList()
+ },
methods: {
+ // 鎵嬪姩鎺ュ崟
+ getaccept(e, orderId, index) {
+ this.$u.api.accept({ orderId })
+ .then(res => {
+ uni.showToast({ title: '鎶㈠崟鎴愬姛锛�', icon: 'success', duration: 2000 })
+ setTimeout(() => {
+ this.page = 1
+ this.next = true
+ this.orderList = []
+ this.getOrderList()
+ }, 2000)
+ })
+ },
+ clickSort(id) {
+ this.sortType = id
+ this.page = 1
+ this.next = true
+ this.orderList = []
+ this.getOrderList()
+ },
clickCate(id) {
this.typeVal = id
this.page = 1
- this.list = []
+ this.next = true
+ this.orderList = []
this.getOrderList()
},
// 璁㈠崟鍒嗛〉
getOrderList() {
+ if (!this.next) return;
this.$u.api.orderPage({
capacity: 10,
page: this.page,
model: {
queryMyOrderType: 2,
- type: this.typeVal
+ type: this.typeVal,
+ sortType: this.sortType,
+ queryLat: this.latitude,
+ queryLgt: this.longitude
}
}).then(res => {
res.data.records.forEach(item => {
@@ -463,10 +502,16 @@
item.wayInfoCopy = JSON.parse(item.wayInfo).map(item => {
return `${item.name}${item.price / 100}鍏�(${item.num}浠�)`
}).join(' | ')
+ // 杩愯揣
+ } else if (item.type === 1) {
+ item.wayInfo = JSON.parse(item.wayInfo)
}
})
- console.log(res.data.records)
this.orderList = [...this.orderList, ...res.data.records]
+
+ if (this.orderList.length === res.data.total) {
+ this.next = false
+ }
})
},
// 鎻愪氦璁㈠崟
@@ -604,6 +649,12 @@
},
clickType(e) {
this.typeId = e
+ if (e === 2) {
+ this.form.categoryId = this.car[0].id
+ this.form.categoryName = this.car[0].name
+ this.carRemark = this.car[0].remark
+ this.carImage = this.car[0].iconFull
+ }
},
clickTypeWork(e) {
this.form.workType = e
@@ -681,9 +732,6 @@
url: `/pages/freight/freight`
})
}
- },
- mverify(e, id){
- console.log('楠岃瘉缁撴灉:', e, id);
},
// 閫夋嫨濂楅
selectMenu(a, b) {
--
Gitblit v1.9.3