|
@@ -3,9 +3,9 @@
|
|
|
<!-- 取货地址部分 -->
|
|
<!-- 取货地址部分 -->
|
|
|
<view class="section-card">
|
|
<view class="section-card">
|
|
|
<view class="flex-a flex-j-b mb-20" @click="handleAddress" v-if="defaultAddr.id">
|
|
<view class="flex-a flex-j-b mb-20" @click="handleAddress" v-if="defaultAddr.id">
|
|
|
- <image src="../static/adderss.png" style="width:40rpx;height: 40rpx;"></image>
|
|
|
|
|
- <view class="flex-d flex-1 ml-24" style="margin-right: 90rpx;">
|
|
|
|
|
- <view class="flex-a flex-j-b mb-10">
|
|
|
|
|
|
|
+ <image src="../static/adderss.png" style="width: 40rpx; height: 40rpx"></image>
|
|
|
|
|
+ <view class="flex-d flex-1 ml-24" style="margin-right: 90rpx">
|
|
|
|
|
+ <view class="flex-a flex-j-b mb-10">
|
|
|
<view :style="titleStyle">发货人:{{ defaultAddr.name }}</view>
|
|
<view :style="titleStyle">发货人:{{ defaultAddr.name }}</view>
|
|
|
<view :style="titleStyle">{{ defaultAddr.mobile }}</view>
|
|
<view :style="titleStyle">{{ defaultAddr.mobile }}</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -31,15 +31,15 @@
|
|
|
<view class="pickup-title">免费上门取货</view>
|
|
<view class="pickup-title">免费上门取货</view>
|
|
|
<view class="pickup-desc">书嗨将预约指定快递上门取件,邮费由书嗨承担</view>
|
|
<view class="pickup-desc">书嗨将预约指定快递上门取件,邮费由书嗨承担</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="flex-a flex-j-b time-card" style="padding:0 10rpx" @click="showTimePicker = true">
|
|
|
|
|
|
|
+ <view class="flex-a flex-j-b time-card" style="padding: 0 10rpx" @click="showTimePicker = true">
|
|
|
<view class="flex-a">
|
|
<view class="flex-a">
|
|
|
<view :style="titleStyle" class="ml-10 font-28">取件时间</view>
|
|
<view :style="titleStyle" class="ml-10 font-28">取件时间</view>
|
|
|
<text class="u-required">*</text>
|
|
<text class="u-required">*</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="flex-a">
|
|
<view class="flex-a">
|
|
|
-
|
|
|
|
|
- <view v-if="selectedTime.day" :style="titleStyle" class="ml-10">{{ selectedTime.day }}
|
|
|
|
|
|
|
+ <view v-if="selectedTime.day" :style="titleStyle" class="ml-10"
|
|
|
|
|
+ >{{ selectedTime.day }}
|
|
|
{{ selectedTime.time }}
|
|
{{ selectedTime.time }}
|
|
|
</view>
|
|
</view>
|
|
|
<view v-else :style="titleStyle" class="ml-10">请选择快递上门取件时间</view>
|
|
<view v-else :style="titleStyle" class="ml-10">请选择快递上门取件时间</view>
|
|
@@ -56,11 +56,13 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="flex-a">
|
|
<view class="flex-a">
|
|
|
- <view :style="titleStyle" class="ml-10">{{ submitData.expressDelivery || '请选择' }}</view>
|
|
|
|
|
|
|
+ <view :style="titleStyle" class="ml-10">{{ submitData.expressDelivery || "请选择" }}</view>
|
|
|
<u-icon name="arrow-right" :size="28" color="#666" top="3"></u-icon>
|
|
<u-icon name="arrow-right" :size="28" color="#666" top="3"></u-icon>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="express-desc">请从【顺丰】或【京东】中选择可正常收寄的快递,如您不选择,则由系统根据区域情况自动分配</view>
|
|
|
|
|
|
|
+ <view class="express-desc"
|
|
|
|
|
+ >请从【顺丰】或【京东】中选择可正常收寄的快递,如您不选择,则由系统根据区域情况自动分配</view
|
|
|
|
|
+ >
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 书籍列表 -->
|
|
<!-- 书籍列表 -->
|
|
@@ -73,12 +75,13 @@
|
|
|
<view class="agreement">
|
|
<view class="agreement">
|
|
|
<u-checkbox v-model="agreed" shape="circle">
|
|
<u-checkbox v-model="agreed" shape="circle">
|
|
|
<text class="agreement-text">我已阅读并同意</text>
|
|
<text class="agreement-text">我已阅读并同意</text>
|
|
|
- <text class="agreement-link">《书嗨用户协议》</text>
|
|
|
|
|
|
|
+ <text class="agreement-link" @click="goToAgreement">《书嗨用户协议》</text>
|
|
|
</u-checkbox>
|
|
</u-checkbox>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="order-summary">
|
|
<view class="order-summary">
|
|
|
<view class="total">
|
|
<view class="total">
|
|
|
- 共<text class="price">{{ totalBooks }}</text>件 预估回收价
|
|
|
|
|
|
|
+ 共<text class="price">{{ totalBooks }}</text
|
|
|
|
|
+ >件 预估回收价
|
|
|
<text class="price">¥{{ totalPrice }}</text>
|
|
<text class="price">¥{{ totalPrice }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
<u-button type="primary" @click="submitOrder" :custom-style="{ margin: 0 }">提交订单</u-button>
|
|
<u-button type="primary" @click="submitOrder" :custom-style="{ margin: 0 }">提交订单</u-button>
|
|
@@ -86,8 +89,14 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 添加快递选择器 -->
|
|
<!-- 添加快递选择器 -->
|
|
|
- <u-picker v-model="showPicker" mode="selector" :range="expressList" @confirm="onExpressConfirm"
|
|
|
|
|
- @cancel="showPicker = false" range-key="name"></u-picker>
|
|
|
|
|
|
|
+ <u-picker
|
|
|
|
|
+ v-model="showPicker"
|
|
|
|
|
+ mode="selector"
|
|
|
|
|
+ :range="expressList"
|
|
|
|
|
+ @confirm="onExpressConfirm"
|
|
|
|
|
+ @cancel="showPicker = false"
|
|
|
|
|
+ range-key="name"
|
|
|
|
|
+ ></u-picker>
|
|
|
|
|
|
|
|
<pickup-time-picker :show.sync="showTimePicker" @confirm="onTimeConfirm"></pickup-time-picker>
|
|
<pickup-time-picker :show.sync="showTimePicker" @confirm="onTimeConfirm"></pickup-time-picker>
|
|
|
|
|
|
|
@@ -96,22 +105,22 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import bookItem from '@/pages-home/components/BookItem.vue'
|
|
|
|
|
-import pickupTimePicker from '@/pages-home/components/PickupTimePicker.vue'
|
|
|
|
|
-import SubmitConfirm from '@/pages-home/components/SubmitConfirm.vue'
|
|
|
|
|
|
|
+import bookItem from "@/pages-home/components/BookItem.vue";
|
|
|
|
|
+import pickupTimePicker from "@/pages-home/components/PickupTimePicker.vue";
|
|
|
|
|
+import SubmitConfirm from "@/pages-home/components/SubmitConfirm.vue";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
bookItem,
|
|
bookItem,
|
|
|
pickupTimePicker,
|
|
pickupTimePicker,
|
|
|
- SubmitConfirm
|
|
|
|
|
|
|
+ SubmitConfirm,
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
titleStyle: {
|
|
titleStyle: {
|
|
|
- 'font-family': 'PingFang SC',
|
|
|
|
|
- 'font-weight': 400,
|
|
|
|
|
- color: '#333333',
|
|
|
|
|
|
|
+ "font-family": "PingFang SC",
|
|
|
|
|
+ "font-weight": 400,
|
|
|
|
|
+ color: "#333333",
|
|
|
},
|
|
},
|
|
|
agreed: false,
|
|
agreed: false,
|
|
|
books: [],
|
|
books: [],
|
|
@@ -123,141 +132,151 @@ export default {
|
|
|
defaultAddr: {},
|
|
defaultAddr: {},
|
|
|
|
|
|
|
|
submitData: {
|
|
submitData: {
|
|
|
- expressDelivery: '',
|
|
|
|
|
- "orderId": "",
|
|
|
|
|
- "addressId": "",
|
|
|
|
|
- "schedulePickupStartTime": "",
|
|
|
|
|
- "schedulePickupEndTime": "",
|
|
|
|
|
- "expressDelivery": "",
|
|
|
|
|
- "remark": ""
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ expressDelivery: "",
|
|
|
|
|
+ orderId: "",
|
|
|
|
|
+ addressId: "",
|
|
|
|
|
+ schedulePickupStartTime: "",
|
|
|
|
|
+ schedulePickupEndTime: "",
|
|
|
|
|
+ expressDelivery: "",
|
|
|
|
|
+ remark: "",
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
totalBooks() {
|
|
totalBooks() {
|
|
|
- return this.books.reduce((sum, book) => sum + (book.num || 1), 0)
|
|
|
|
|
|
|
+ return this.books.reduce((sum, book) => sum + (book.num || 1), 0);
|
|
|
},
|
|
},
|
|
|
totalPrice() {
|
|
totalPrice() {
|
|
|
- return this.books.reduce((sum, book) => sum + book.recycleMoney, 0).toFixed(2)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return this.books.reduce((sum, book) => sum + book.recycleMoney, 0).toFixed(2);
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
//时间选择
|
|
//时间选择
|
|
|
onTimeConfirm(data) {
|
|
onTimeConfirm(data) {
|
|
|
- this.selectedTime = data
|
|
|
|
|
|
|
+ this.selectedTime = data;
|
|
|
//格式化提交数据的时间
|
|
//格式化提交数据的时间
|
|
|
- let date = this.$u.timeFormat(data.date, 'yyyy-mm-dd')
|
|
|
|
|
- let times = data.time.split('-')
|
|
|
|
|
|
|
+ let date = this.$u.timeFormat(data.date, "yyyy-mm-dd");
|
|
|
|
|
+ let times = data.time.split("-");
|
|
|
|
|
|
|
|
- this.submitData.schedulePickupStartTime = `${date} ${times[0]}`
|
|
|
|
|
- this.submitData.schedulePickupEndTime = `${date} ${times[1]}`
|
|
|
|
|
- console.log(date, this.submitData, 'data')
|
|
|
|
|
|
|
+ this.submitData.schedulePickupStartTime = `${date} ${times[0]}`;
|
|
|
|
|
+ this.submitData.schedulePickupEndTime = `${date} ${times[1]}`;
|
|
|
|
|
+ console.log(date, this.submitData, "data");
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
//打开快递选择器
|
|
//打开快递选择器
|
|
|
showExpressPicker() {
|
|
showExpressPicker() {
|
|
|
- this.showPicker = true
|
|
|
|
|
|
|
+ this.showPicker = true;
|
|
|
},
|
|
},
|
|
|
- //确认选择快递
|
|
|
|
|
|
|
+ //确认选择快递
|
|
|
onExpressConfirm(e) {
|
|
onExpressConfirm(e) {
|
|
|
- if (!e.length) return
|
|
|
|
|
- let item = this.expressList[e[0]]
|
|
|
|
|
- this.submitData.expressDelivery = item.name
|
|
|
|
|
- this.showPicker = false
|
|
|
|
|
|
|
+ if (!e.length) return;
|
|
|
|
|
+ let item = this.expressList[e[0]];
|
|
|
|
|
+ this.submitData.expressDelivery = item.name;
|
|
|
|
|
+ this.showPicker = false;
|
|
|
},
|
|
},
|
|
|
//添加或者选择地址
|
|
//添加或者选择地址
|
|
|
handleAddress() {
|
|
handleAddress() {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: `/pages-mine/pages/address/list?id=${this.defaultAddr.id}&isSelect=1`
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ url: `/pages-mine/pages/address/list?id=${this.defaultAddr.id}&isSelect=1`,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
calculateTotal() {
|
|
calculateTotal() {
|
|
|
- this.totalBooks = this.books.reduce((sum, book) => sum + book.quantity, 0)
|
|
|
|
|
|
|
+ this.totalBooks = this.books.reduce((sum, book) => sum + book.quantity, 0);
|
|
|
this.totalPrice = this.books
|
|
this.totalPrice = this.books
|
|
|
.reduce((sum, book) => sum + book.quantity * parseFloat(book.price), 0)
|
|
.reduce((sum, book) => sum + book.quantity * parseFloat(book.price), 0)
|
|
|
- .toFixed(2)
|
|
|
|
|
|
|
+ .toFixed(2);
|
|
|
},
|
|
},
|
|
|
submitOrder() {
|
|
submitOrder() {
|
|
|
|
|
+ if (!this.submitData.addressId) {
|
|
|
|
|
+ this.$u.toast("请选择取货地址");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!this.selectedTime.day) {
|
|
if (!this.selectedTime.day) {
|
|
|
- this.$u.toast('请选择取件时间')
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ this.$u.toast("请选择取件时间");
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
if (!this.agreed) {
|
|
if (!this.agreed) {
|
|
|
- this.$u.toast('请先同意用户协议')
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ this.$u.toast("请先同意用户协议");
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
// 显示确认弹窗
|
|
// 显示确认弹窗
|
|
|
- this.$refs.submitConfirmDialog.openPopup()
|
|
|
|
|
|
|
+ this.$refs.submitConfirmDialog.openPopup();
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 确认提交订单
|
|
// 确认提交订单
|
|
|
handleConfirmSubmit() {
|
|
handleConfirmSubmit() {
|
|
|
// 处理订单提交
|
|
// 处理订单提交
|
|
|
- uni.$u.http.post('/token/order/submitOrder', this.submitData).then(res => {
|
|
|
|
|
|
|
+ uni.$u.http.post("/token/order/submitOrder", this.submitData).then((res) => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: "/pages-home/pages/order-success"
|
|
|
|
|
- })
|
|
|
|
|
- uni.removeStorageSync('selectAddr')
|
|
|
|
|
|
|
+ url: "/pages-home/pages/order-success",
|
|
|
|
|
+ });
|
|
|
|
|
+ uni.removeStorageSync("selectAddr");
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
title: res.msg,
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
//获取默认地址 /api/token/user/address/getDefault
|
|
//获取默认地址 /api/token/user/address/getDefault
|
|
|
getDefaultAddress() {
|
|
getDefaultAddress() {
|
|
|
- uni.$u.http.get('/token/user/address/getDefault').then(res => {
|
|
|
|
|
|
|
+ uni.$u.http.get("/token/user/address/getDefault").then((res) => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
- this.defaultAddr = res.data
|
|
|
|
|
- this.submitData.addressId = this.defaultAddr.id
|
|
|
|
|
|
|
+ this.defaultAddr = res.data;
|
|
|
|
|
+ this.submitData.addressId = this.defaultAddr.id;
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
//获取当前用户未提交订单 /api/token/order/lastOrder
|
|
//获取当前用户未提交订单 /api/token/order/lastOrder
|
|
|
getLastOrder() {
|
|
getLastOrder() {
|
|
|
- uni.$u.http.get('/token/order/lastOrder').then(res => {
|
|
|
|
|
|
|
+ uni.$u.http.get("/token/order/lastOrder").then((res) => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
- this.books = res.data?.orderDetailList ? res.data.orderDetailList?.map(v => {
|
|
|
|
|
- v.orderId = res.data.orderId
|
|
|
|
|
- return v
|
|
|
|
|
- }) : [],
|
|
|
|
|
-
|
|
|
|
|
- this.submitData.orderId = this.books[0].orderId
|
|
|
|
|
|
|
+ this.books = res.data?.orderDetailList
|
|
|
|
|
+ ? res.data.orderDetailList?.map((v) => {
|
|
|
|
|
+ v.orderId = res.data.orderId;
|
|
|
|
|
+ return v;
|
|
|
|
|
+ })
|
|
|
|
|
+ : [];
|
|
|
|
|
+
|
|
|
|
|
+ this.submitData.orderId = this.books[0].orderId;
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
//获取预提交订单
|
|
//获取预提交订单
|
|
|
getPreSubmitOrder() {
|
|
getPreSubmitOrder() {
|
|
|
- let orderId = uni.getStorageSync('orderId')
|
|
|
|
|
- uni.$u.http.get('/token/order/preSubmit?orderId=' + orderId).then(res => {
|
|
|
|
|
- this.submitData.orderId = orderId
|
|
|
|
|
- this.defaultAddr = res.data.defaultAddress
|
|
|
|
|
- this.submitData.addressId = this.defaultAddr.id
|
|
|
|
|
-
|
|
|
|
|
- this.books = res.data.orderDetailList
|
|
|
|
|
- this.expressList = res.data.expressTypes.map(v => ({
|
|
|
|
|
- name: v
|
|
|
|
|
- }))
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ let orderId = uni.getStorageSync("orderId");
|
|
|
|
|
+ uni.$u.http.get("/token/order/preSubmit?orderId=" + orderId).then((res) => {
|
|
|
|
|
+ this.submitData.orderId = orderId;
|
|
|
|
|
+ this.defaultAddr = res.data.defaultAddress;
|
|
|
|
|
+ this.submitData.addressId = this.defaultAddr.id;
|
|
|
|
|
+
|
|
|
|
|
+ this.books = res.data.orderDetailList;
|
|
|
|
|
+ this.expressList = res.data.expressTypes.map((v) => ({
|
|
|
|
|
+ name: v,
|
|
|
|
|
+ }));
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ goToAgreement() {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: "/pages-home/pages/user-agreement",
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- this.getPreSubmitOrder()
|
|
|
|
|
|
|
+ this.getPreSubmitOrder();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onShow() {
|
|
onShow() {
|
|
|
- let selectAddr = uni.getStorageSync('selectAddr')
|
|
|
|
|
|
|
+ let selectAddr = uni.getStorageSync("selectAddr");
|
|
|
if (selectAddr) {
|
|
if (selectAddr) {
|
|
|
- this.defaultAddr = selectAddr
|
|
|
|
|
- this.submitData.addressId = selectAddr.id
|
|
|
|
|
|
|
+ this.defaultAddr = selectAddr;
|
|
|
|
|
+ this.submitData.addressId = selectAddr.id;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@@ -277,13 +296,13 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.u-required {
|
|
.u-required {
|
|
|
- color: #FF0000;
|
|
|
|
|
|
|
+ color: #ff0000;
|
|
|
margin-left: 8rpx;
|
|
margin-left: 8rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.time-card {
|
|
.time-card {
|
|
|
height: 80rpx;
|
|
height: 80rpx;
|
|
|
- background: #F8F8F8;
|
|
|
|
|
|
|
+ background: #f8f8f8;
|
|
|
border-radius: 10rpx;
|
|
border-radius: 10rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -344,4 +363,4 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|