|
|
@@ -1,27 +1,12 @@
|
|
|
<template>
|
|
|
- <view
|
|
|
- class="container"
|
|
|
- :style="{ background: containerBg }"
|
|
|
- :class="bookList.length ? 'book-list' : 'no-list'"
|
|
|
- >
|
|
|
- <u-navbar
|
|
|
- :is-back="false"
|
|
|
- :border-bottom="false"
|
|
|
- :background="{ background: navbarBackground }"
|
|
|
- >
|
|
|
+ <view class="container" :style="{ background: containerBg }" :class="bookList.length ? 'book-list' : 'no-list'">
|
|
|
+ <u-navbar :is-back="false" :border-bottom="false" :background="{ background: navbarBackground }">
|
|
|
<text class="nav-title">卖书给书嗨</text>
|
|
|
</u-navbar>
|
|
|
|
|
|
<not-scanned v-if="!bookList.length"></not-scanned>
|
|
|
- <scan-book-list
|
|
|
- v-else
|
|
|
- @updateBooks="updateBooksList"
|
|
|
- @deleted="handleDeleteBook"
|
|
|
- :bookList="bookList"
|
|
|
- ref="scanBookList"
|
|
|
- @upsell="handleUpsell"
|
|
|
- @refresh="getLastOrder"
|
|
|
- ></scan-book-list>
|
|
|
+ <scan-book-list v-else @updateBooks="updateBooksList" @deleted="handleDeleteBook" :bookList="bookList"
|
|
|
+ ref="scanBookList" @upsell="handleUpsell" @refresh="getLastOrder"></scan-book-list>
|
|
|
<!-- 底部固定按钮 -->
|
|
|
<view class="bottom-fixed">
|
|
|
<view class="btn-wrap mb-20">
|
|
|
@@ -35,71 +20,40 @@
|
|
|
</button>
|
|
|
</view>
|
|
|
|
|
|
- <view
|
|
|
- class="flex-a flex-j-b pad-20"
|
|
|
- style="padding-top: 0"
|
|
|
- v-if="bookList.length"
|
|
|
- >
|
|
|
+ <view class="flex-a flex-j-b pad-20" style="padding-top: 0" v-if="bookList.length">
|
|
|
<view class="left-info" style="min-width: 194px">
|
|
|
<view class="flex-a common-text">
|
|
|
共
|
|
|
<text class="color-red">{{ orderInfo.totalNum }}</text>
|
|
|
件 预估回收价
|
|
|
- <text class="color-red"
|
|
|
- >¥{{ orderInfo.totalRecycleMoney || 0 }}</text
|
|
|
- >
|
|
|
+ <text class="color-red">¥{{ orderInfo.totalRecycleMoney || 0 }}</text>
|
|
|
</view>
|
|
|
- <text class="common-text tip"
|
|
|
- >*旧书预估价格满{{ orderInfo.minOrderMoney }}元起收</text
|
|
|
- >
|
|
|
+ <text class="common-text tip">*旧书预估价格满{{ orderInfo.minOrderMoney }}元起收</text>
|
|
|
</view>
|
|
|
|
|
|
- <button
|
|
|
- class="scan-btn next-btn"
|
|
|
- @click="handleValidate"
|
|
|
- :disabled="isDisabled"
|
|
|
- >
|
|
|
+ <button class="scan-btn next-btn" @click="handleValidate" :disabled="isDisabled">
|
|
|
下一步
|
|
|
</button>
|
|
|
</view>
|
|
|
|
|
|
- <service-info
|
|
|
- v-if="bookList.length"
|
|
|
- :serviceList="serviceList"
|
|
|
- :firstOrder="orderInfo.firstOrder"
|
|
|
- ></service-info>
|
|
|
+ <service-info v-if="bookList.length" :serviceList="serviceList"
|
|
|
+ :firstOrder="orderInfo.firstOrder"></service-info>
|
|
|
</view>
|
|
|
|
|
|
- <InputIsbn
|
|
|
- ref="isbnPopup"
|
|
|
- @submit="(isbn) => checkBookISBN(isbn, 'input')"
|
|
|
- />
|
|
|
+ <InputIsbn ref="isbnPopup" @submit="(isbn) => checkBookISBN(isbn, 'input')" />
|
|
|
<!-- 套装书说明弹窗 -->
|
|
|
- <CommonDialog
|
|
|
- ref="setBookDialog"
|
|
|
- title="套装书说明"
|
|
|
- :showCancel="false"
|
|
|
- @confirm="handleSetBookConfirm"
|
|
|
- >
|
|
|
- <text
|
|
|
- >套装书(ISBN码相同的系列书箱)只需扫描其中一册,扫码价即套装价。打包时请把所有单册统在一起或放在一个袋子里寄出。</text
|
|
|
- >
|
|
|
+ <CommonDialog ref="setBookDialog" title="套装书说明" :showCancel="false" @confirm="handleSetBookConfirm">
|
|
|
+ <text>套装书(ISBN码相同的系列书箱)只需扫描其中一册,扫码价即套装价。打包时请把所有单册统在一起或放在一个袋子里寄出。</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 暂不回收弹窗 -->
|
|
|
- <CommonDialog
|
|
|
- ref="notAcceptDialog"
|
|
|
- title="暂不回收"
|
|
|
- :showCancel="false"
|
|
|
- >
|
|
|
+ <CommonDialog ref="notAcceptDialog" title="暂不回收" :showCancel="false">
|
|
|
<text>这本书暂时不回收,请您过段时间再来试试~</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 暂无信息弹窗 -->
|
|
|
<CommonDialog ref="noInfoDialog" title="暂无信息" :showCancel="false">
|
|
|
- <text
|
|
|
- >抱歉,没有该书的信息,书嗨会定期补充图书信息,请您过段时间再来试试~</text
|
|
|
- >
|
|
|
+ <text>抱歉,没有该书的信息,书嗨会定期补充图书信息,请您过段时间再来试试~</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 扫累了弹窗 -->
|
|
|
@@ -108,29 +62,17 @@
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 该书超出最大回收本数 maxAcceptDialog-->
|
|
|
- <CommonDialog
|
|
|
- ref="maxAcceptDialog"
|
|
|
- title="温馨提示"
|
|
|
- :showCancel="false"
|
|
|
- >
|
|
|
+ <CommonDialog ref="maxAcceptDialog" title="温馨提示" :showCancel="false">
|
|
|
<text>该书超出最大回收本数</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 单个订单最多40本书 orderMaxNumDialog-->
|
|
|
- <CommonDialog
|
|
|
- ref="orderMaxNumDialog"
|
|
|
- title="温馨提示"
|
|
|
- :showCancel="false"
|
|
|
- >
|
|
|
+ <CommonDialog ref="orderMaxNumDialog" title="温馨提示" :showCancel="false">
|
|
|
<text>单个订单最多40本书</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 删除活动书籍弹窗 -->
|
|
|
- <common-dialog
|
|
|
- ref="deleteDialog"
|
|
|
- title="温馨提示"
|
|
|
- @confirm="confirmDelete"
|
|
|
- >
|
|
|
+ <common-dialog ref="deleteDialog" title="温馨提示" @confirm="confirmDelete">
|
|
|
<text>{{
|
|
|
deleteBook.upsellMoney
|
|
|
? "此书为限时加价收图书,删除后再次添加将失去加价收资格,确定删除吗?"
|
|
|
@@ -140,45 +82,25 @@
|
|
|
|
|
|
<!-- 此订单还有未加价的图书,提交订单后将失去加价资格,确定提交吗? -->
|
|
|
<common-dialog ref="noUpsellDialog" title="温馨提示" @confirm="onNext">
|
|
|
- <text
|
|
|
- >此订单还有未加价的图书,提交订单后将失去加价资格,确定提交吗?</text
|
|
|
- >
|
|
|
+ <text>此订单还有未加价的图书,提交订单后将失去加价资格,确定提交吗?</text>
|
|
|
</common-dialog>
|
|
|
|
|
|
<!-- 温馨提示弹窗 -->
|
|
|
- <KindReminder
|
|
|
- ref="kindReminder"
|
|
|
- @start="handleStartSelling"
|
|
|
- @viewRules="handleViewRules"
|
|
|
- />
|
|
|
-
|
|
|
- <view
|
|
|
- class="customer-service"
|
|
|
- :style="{
|
|
|
- left: servicePosition.left + 'px',
|
|
|
- right: servicePosition.right + 'px',
|
|
|
- bottom: servicePosition.bottom + 'px',
|
|
|
- }"
|
|
|
- @touchstart="touchStart"
|
|
|
- @touchmove="touchMove"
|
|
|
- @touchend="touchEnd"
|
|
|
- >
|
|
|
+ <KindReminder ref="kindReminder" @start="handleStartSelling" @viewRules="handleViewRules" />
|
|
|
+
|
|
|
+ <view class="customer-service" :style="{
|
|
|
+ left: servicePosition.left + 'px',
|
|
|
+ right: servicePosition.right + 'px',
|
|
|
+ bottom: servicePosition.bottom + 'px',
|
|
|
+ }" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
|
|
|
<!-- #ifdef MP-ALIPAY -->
|
|
|
<button class="service-btn" @click="navigateToCustomerService">
|
|
|
- <image
|
|
|
- src="/static/img/kf.png"
|
|
|
- mode="widthFix"
|
|
|
- style="width: 126rpx; height: 140rpx"
|
|
|
- ></image>
|
|
|
+ <image src="/static/img/kf.png" mode="widthFix" style="width: 126rpx; height: 140rpx"></image>
|
|
|
</button>
|
|
|
<!-- #endif -->
|
|
|
<!-- #ifndef MP-ALIPAY -->
|
|
|
<button class="service-btn" open-type="contact">
|
|
|
- <image
|
|
|
- src="/static/img/kf.png"
|
|
|
- mode="widthFix"
|
|
|
- style="width: 126rpx; height: 140rpx"
|
|
|
- ></image>
|
|
|
+ <image src="/static/img/kf.png" mode="widthFix" style="width: 126rpx; height: 140rpx"></image>
|
|
|
</button>
|
|
|
<!-- #endif -->
|
|
|
</view>
|
|
|
@@ -213,6 +135,8 @@ import UpsellBook from "./components/upsell-book.vue";
|
|
|
import UpsellRules from "./components/upsell-rules.vue";
|
|
|
import UpsellShare from "./components/upsell-share.vue";
|
|
|
import UpsellQrcode from "./components/upsell-qrcode.vue";
|
|
|
+import { eventBus } from "@/utils/event-bus";
|
|
|
+
|
|
|
const app = getApp();
|
|
|
|
|
|
export default {
|
|
|
@@ -278,18 +202,14 @@ export default {
|
|
|
return this.bookList.length > 0 ? "300rpx" : "110rpx";
|
|
|
},
|
|
|
totalBooks() {
|
|
|
- return this.bookList.reduce(
|
|
|
- (sum, book) => sum + (book.num || 1),
|
|
|
- 0
|
|
|
- );
|
|
|
+ return this.bookList.reduce((sum, book) => sum + (book.num || 1), 0);
|
|
|
},
|
|
|
totalPrice() {
|
|
|
return this.bookList
|
|
|
.reduce(
|
|
|
(sum, book) =>
|
|
|
- sum +
|
|
|
- book.recyclePrice * (book.num || 1) +
|
|
|
- book.currUpsellMoney || 0,
|
|
|
+ sum + book.recyclePrice * (book.num || 1) + book.currUpsellMoney ||
|
|
|
+ 0,
|
|
|
0
|
|
|
)
|
|
|
.toFixed(2);
|
|
|
@@ -313,8 +233,7 @@ export default {
|
|
|
return {
|
|
|
title: "书嗨",
|
|
|
path: "/pages/home/index?upsellCode=" + upsellCode,
|
|
|
- imageUrl:
|
|
|
- "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
|
|
|
+ imageUrl: "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
|
|
|
desc: "书嗨,专注于书籍交易的平台,提供新书和二手书的买卖服务",
|
|
|
};
|
|
|
} else {
|
|
|
@@ -334,8 +253,7 @@ export default {
|
|
|
return {
|
|
|
title: "书嗨",
|
|
|
path: "/pages/home/index?upsellCode=" + upsellCode,
|
|
|
- imageUrl:
|
|
|
- "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
|
|
|
+ imageUrl: "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
|
|
|
desc: "书嗨,专注于书籍交易的平台,提供新书和二手书的买卖服务",
|
|
|
};
|
|
|
} else {
|
|
|
@@ -353,20 +271,57 @@ export default {
|
|
|
this.screenHeight = res.windowHeight;
|
|
|
},
|
|
|
});
|
|
|
- setTimeout(() => {
|
|
|
- let loginSuccess = uni.getStorageSync("loginSuccess");
|
|
|
- let upsellCode = app.globalData.upsellCode;
|
|
|
|
|
|
- if (loginSuccess && upsellCode) {
|
|
|
- console.log(loginSuccess, "登录成功loginSuccess");
|
|
|
- this.$refs.shareRef?.open(upsellCode);
|
|
|
- uni.removeStorageSync("loginSuccess");
|
|
|
+ eventBus.on("loginSuccess", (data) => {
|
|
|
+ console.log(data, "登录成功loginSuccess");
|
|
|
+ this.loginSuccess(data);
|
|
|
+ app.globalData.isColdLaunch = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //针对多次扫码的热启动场景,需要判断是否是冷启动
|
|
|
+ onLoad(options) {
|
|
|
+ console.log(options, app.globalData.isColdLaunch, "onLoad");
|
|
|
+ if (app.globalData.isColdLaunch) return
|
|
|
+
|
|
|
+ if (options.scene) {
|
|
|
+ let params = {};
|
|
|
+ // 对 scene 进行解码
|
|
|
+ const decodeScene = decodeURIComponent(options.scene);
|
|
|
+ // 拆分参数
|
|
|
+ const paramPairs = decodeScene.split('&');
|
|
|
+ paramPairs.forEach((pair) => {
|
|
|
+ const [key, value] = pair.split('=');
|
|
|
+ params[key] = value;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (params.upsellCode) {
|
|
|
+ this.$refs.shareRef?.open(params.upsellCode);
|
|
|
this.getLastOrder();
|
|
|
}
|
|
|
- }, 1000);
|
|
|
+ } else if (options.upsellCode) {
|
|
|
+ this.$refs.shareRef?.open(options.upsellCode);
|
|
|
+ } else {
|
|
|
+ this.getLastOrder();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //卸载loginSuccess事件
|
|
|
+ onUnload() {
|
|
|
+ uni.removeStorageSync("upsellCode");
|
|
|
+ eventBus.off("loginSuccess");
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ // 登录成功之后
|
|
|
+ loginSuccess() {
|
|
|
+ let upsellCode = uni.getStorageSync("upsellCode");
|
|
|
+ console.log(upsellCode, "登录成功之后助力的 code值:", upsellCode);
|
|
|
+ if (upsellCode) {
|
|
|
+ this.$refs.shareRef?.open(upsellCode);
|
|
|
+ }
|
|
|
+ this.getLastOrder();
|
|
|
+ },
|
|
|
+
|
|
|
//删除书籍
|
|
|
handleDeleteBook(book) {
|
|
|
this.deleteBook = book;
|
|
|
@@ -375,7 +330,7 @@ export default {
|
|
|
//支付宝小程序的客服
|
|
|
navigateToCustomerService() {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages-mine/pages/customer-service'
|
|
|
+ url: "/pages-mine/pages/customer-service",
|
|
|
});
|
|
|
},
|
|
|
|
|
|
@@ -423,8 +378,7 @@ export default {
|
|
|
typeof this.servicePosition.bottom === "string" &&
|
|
|
this.servicePosition.bottom.includes("%")
|
|
|
) {
|
|
|
- const percentage =
|
|
|
- parseFloat(this.servicePosition.bottom) / 100;
|
|
|
+ const percentage = parseFloat(this.servicePosition.bottom) / 100;
|
|
|
this.initialBottom = this.screenHeight * percentage;
|
|
|
} else {
|
|
|
this.initialBottom = parseFloat(this.servicePosition.bottom);
|
|
|
@@ -652,9 +606,9 @@ export default {
|
|
|
|
|
|
this.bookList = res.data?.orderDetailList
|
|
|
? res.data.orderDetailList.map((v) => {
|
|
|
- v.orderId = res.data.orderId;
|
|
|
- return v;
|
|
|
- })
|
|
|
+ v.orderId = res.data.orderId;
|
|
|
+ return v;
|
|
|
+ })
|
|
|
: [];
|
|
|
this.serviceList = res.data.serviceList || [];
|
|
|
}
|
|
|
@@ -674,14 +628,6 @@ export default {
|
|
|
uni.setStorageSync("kindReminderShown", true);
|
|
|
},
|
|
|
},
|
|
|
-
|
|
|
- onShow() {
|
|
|
- // 获取上一个订单
|
|
|
- setTimeout(() => {
|
|
|
- let token = uni.getStorageSync("token");
|
|
|
- token && this.getLastOrder();
|
|
|
- }, 300);
|
|
|
- },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
@@ -726,9 +672,9 @@ export default {
|
|
|
font-size: 34rpx;
|
|
|
color: #ffffff;
|
|
|
padding-left: 40rpx;
|
|
|
- /* #ifdef MP-ALIPAY */
|
|
|
- padding-left: 70rpx;
|
|
|
- /* #endif */
|
|
|
+ /* #ifdef MP-ALIPAY */
|
|
|
+ padding-left: 70rpx;
|
|
|
+ /* #endif */
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -747,6 +693,7 @@ export default {
|
|
|
color: #ff0000;
|
|
|
margin: 0 10rpx;
|
|
|
}
|
|
|
+
|
|
|
.color-green {
|
|
|
color: #276f1e;
|
|
|
}
|