|
|
@@ -5,8 +5,12 @@
|
|
|
</u-navbar>
|
|
|
|
|
|
<not-scanned v-if="!bookList.length"></not-scanned>
|
|
|
- <scan-book-list v-else @updateBooks="updateBooksList" @deleted="getLastOrder"
|
|
|
- :bookList="bookList"></scan-book-list>
|
|
|
+ <scan-book-list
|
|
|
+ v-else
|
|
|
+ @updateBooks="updateBooksList"
|
|
|
+ @deleted="getLastOrder"
|
|
|
+ :bookList="bookList"
|
|
|
+ ></scan-book-list>
|
|
|
<!-- 底部固定按钮 -->
|
|
|
<view class="bottom-fixed">
|
|
|
<view class="btn-wrap mb-20">
|
|
|
@@ -20,30 +24,27 @@
|
|
|
</button>
|
|
|
</view>
|
|
|
|
|
|
- <view class="flex-a flex-j-b pad-20" style="padding-top:0 ;" v-if="bookList.length">
|
|
|
- <view class="left-info">
|
|
|
+ <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">{{ totalBooks }}</text>件
|
|
|
- 预估回收价 <text class="color-red">¥{{ totalPrice || 0 }}</text>
|
|
|
+ 共<text class="color-red">{{ totalBooks }}</text
|
|
|
+ >件 预估回收价 <text class="color-red">¥{{ totalPrice || 0 }}</text>
|
|
|
</view>
|
|
|
- <text class="common-text tip">*旧书预估价格满30元起收</text>
|
|
|
+ <text class="common-text tip">*旧书预估价格满 {{ orderInfo.minOrderMoney }} 元起收</text>
|
|
|
</view>
|
|
|
|
|
|
- <button class="scan-btn next-btn" @click="onNext">下一步</button>
|
|
|
+ <button class="scan-btn next-btn" @click="onNext" :disabled="isDisabled">下一步</button>
|
|
|
</view>
|
|
|
|
|
|
- <view class="service-icons" v-if="bookList.length">
|
|
|
- <view class="icon-item" v-for="(item, index) in serviceItems" :key="index" @tap="showServiceGuarantee">
|
|
|
- <u-icon :name="item.icon" size="32" color="#FFF6ED"></u-icon>
|
|
|
- <text style="margin-left: 6rpx;">{{ item.text }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <service-info v-if="bookList.length" :serviceList="serviceList"></service-info>
|
|
|
</view>
|
|
|
|
|
|
<InputIsbn ref="isbnPopup" @submit="checkBookISBN" />
|
|
|
<!-- 套装书说明弹窗 -->
|
|
|
<CommonDialog ref="setBookDialog" title="套装书说明" :showCancel="false">
|
|
|
- <text>套装书(ISBN码相同的系列书箱)只需扫描其中一册,扫码价即套装价。打包时请把所有单册统在一起或放在一个袋子里寄出。</text>
|
|
|
+ <text
|
|
|
+ >套装书(ISBN码相同的系列书箱)只需扫描其中一册,扫码价即套装价。打包时请把所有单册统在一起或放在一个袋子里寄出。</text
|
|
|
+ >
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 暂不回收弹窗 -->
|
|
|
@@ -53,206 +54,246 @@
|
|
|
|
|
|
<!-- 暂无信息弹窗 -->
|
|
|
<CommonDialog ref="noInfoDialog" title="暂无信息" :showCancel="false">
|
|
|
- <text>抱歉,没有该书的信息,书喵会定期补充图书信息,请您过段时间再来试试~</text>
|
|
|
+ <text>抱歉,没有该书的信息,书嗨会定期补充图书信息,请您过段时间再来试试~</text>
|
|
|
</CommonDialog>
|
|
|
|
|
|
<!-- 扫累了弹窗 -->
|
|
|
- <CommonDialog ref="tiredDialog" title="暂不回收" :showCancel="false">
|
|
|
+ <CommonDialog ref="tiredDialog" title="温馨提示" :showCancel="false">
|
|
|
<text>扫累了,休息休息吧~</text>
|
|
|
</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>
|
|
|
+
|
|
|
+ <!-- 温馨提示弹窗 -->
|
|
|
+ <KindReminder ref="kindReminder" @start="handleStartSelling" @viewRules="handleViewRules" />
|
|
|
+
|
|
|
+ <view class="customer-service">
|
|
|
+ <button class="service-btn" open-type="contact">
|
|
|
+ <image src="/static/img/kf.png" mode="widthFix" style="width: 126rpx; height: 140rpx"></image>
|
|
|
+ </button>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import notScanned from './components/notScanned.vue'
|
|
|
-import InputIsbn from './components/InputIsbn.vue';
|
|
|
-import ScanBookList from './components/ScanBookList.vue';
|
|
|
-import CommonDialog from '@/components/common-dialog.vue';
|
|
|
+import notScanned from "./components/notScanned.vue";
|
|
|
+import InputIsbn from "./components/InputIsbn.vue";
|
|
|
+import ScanBookList from "./components/ScanBookList.vue";
|
|
|
+import CommonDialog from "@/components/common-dialog.vue";
|
|
|
+import KindReminder from "./components/KindReminder.vue";
|
|
|
+import ServiceInfo from "./components/ServiceInfo.vue";
|
|
|
export default {
|
|
|
components: {
|
|
|
notScanned,
|
|
|
InputIsbn,
|
|
|
ScanBookList,
|
|
|
- CommonDialog
|
|
|
+ CommonDialog,
|
|
|
+ KindReminder,
|
|
|
+ ServiceInfo,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ orderInfo: {},
|
|
|
collapseState: {
|
|
|
step1: false,
|
|
|
- step3: false
|
|
|
+ step3: false,
|
|
|
},
|
|
|
scrollTop: 0,
|
|
|
bookList: [],
|
|
|
- serviceItems: [{
|
|
|
- icon: 'gift',
|
|
|
- text: '免费退回'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'clock',
|
|
|
- text: '24小时验'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'rmb-circle',
|
|
|
- text: '极速打款'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'shield',
|
|
|
- text: '卖亏必赔'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+ serviceList: [],
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
navbarBackground() {
|
|
|
if (this.scrollTop > 0) {
|
|
|
- return 'linear-gradient(180deg, #4CD964 0%, #5ff178 100%)'
|
|
|
+ return "linear-gradient(180deg, #4CD964 0%, #5ff178 100%)";
|
|
|
}
|
|
|
- return 'transparent'
|
|
|
+ return "transparent";
|
|
|
},
|
|
|
containerBg() {
|
|
|
- return this.bookList.length > 0 ? 'linear-gradient(180deg, #4CD964 0%, #F8F8F8 25%)' :
|
|
|
- 'linear-gradient(180deg, #4CD964 0%, #ffffff 25%)'
|
|
|
+ return this.bookList.length > 0
|
|
|
+ ? "linear-gradient(180deg, #4CD964 0%, #F8F8F8 25%)"
|
|
|
+ : "linear-gradient(180deg, #4CD964 0%, #ffffff 25%)";
|
|
|
},
|
|
|
containerPb() {
|
|
|
- return this.bookList.length > 0 ? '300rpx' : '110rpx'
|
|
|
+ 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), 0).toFixed(2)
|
|
|
- }
|
|
|
+ return this.bookList.reduce((sum, book) => sum + book.recyclePrice * (book.num || 1), 0).toFixed(2);
|
|
|
+ },
|
|
|
+ isDisabled() {
|
|
|
+ return this.totalPrice < this.orderInfo.minOrderMoney;
|
|
|
+ },
|
|
|
},
|
|
|
onPageScroll(e) {
|
|
|
this.$nextTick(() => {
|
|
|
- this.scrollTop = e.scrollTop
|
|
|
- })
|
|
|
+ this.scrollTop = e.scrollTop;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
//提交
|
|
|
onNext() {
|
|
|
- let orderId = this.bookList[0].orderId
|
|
|
+ let orderId = this.orderInfo.orderId;
|
|
|
//预提交
|
|
|
- uni.$u.http.get('/token/order/preSubmit?orderId=' + orderId).then(res => {
|
|
|
+ uni.$u.http.get("/token/order/preSubmit?orderId=" + orderId).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
if (res.data.code == 1 || res.data.code == 2) {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages-home/pages/book-order"
|
|
|
- })
|
|
|
- uni.setStorageSync('orderId', orderId)
|
|
|
+ url: "/pages-home/pages/book-order",
|
|
|
+ });
|
|
|
+ uni.setStorageSync("orderId", orderId);
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: res.msg
|
|
|
- })
|
|
|
+ icon: "none",
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
}
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: res.msg
|
|
|
- })
|
|
|
+ icon: "none",
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
updateBooksList(data) {
|
|
|
- this.bookList = data
|
|
|
+ this.bookList = data;
|
|
|
},
|
|
|
|
|
|
toggleCollapse(step) {
|
|
|
- this.$set(this.collapseState, step, !this.collapseState[step])
|
|
|
+ this.$set(this.collapseState, step, !this.collapseState[step]);
|
|
|
},
|
|
|
handleScan() {
|
|
|
uni.scanCode({
|
|
|
- scanType: ['barCode'],
|
|
|
+ scanType: ["barCode"],
|
|
|
success: (res) => {
|
|
|
- this.checkBookISBN(res.result)
|
|
|
+ this.checkBookISBN(res.result);
|
|
|
},
|
|
|
fail: () => {
|
|
|
uni.showToast({
|
|
|
- title: '扫码失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ title: "扫码失败",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
checkBookISBN(isbn) {
|
|
|
- uni.$u.http.get('/token/order/scanIsbn?isbn=' + isbn).then(res => {
|
|
|
+ uni.$u.http.get("/token/order/scanIsbn?isbn=" + isbn).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- let code = res.data.code
|
|
|
+ let code = res.data.code;
|
|
|
if (code == 1) {
|
|
|
- res.data.num = 1
|
|
|
- this.bookList.push(res.data)
|
|
|
+ res.data.num = 1;
|
|
|
+ res.data.recyclePrice = res.data.recycleMoney;
|
|
|
+ this.bookList.push(res.data);
|
|
|
} else if (code == 2) {
|
|
|
- let item = this.bookList.find(v => v.isbn === isbn)
|
|
|
- item.num = item.num + 1
|
|
|
+ let item = this.bookList.find((v) => v.isbn === isbn);
|
|
|
+ item.num = item.num + 1;
|
|
|
} else {
|
|
|
- this.handleBookCode(res.data.code)
|
|
|
+ this.handleBookCode(res.data.code);
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
//处理扫码之后不同的状态 0-扫码频繁 1-成功 2-本单已有该书,数量+1 3-没有该书 4-本书暂不回收 5-超过每单最大可卖数量 6-单个订单最多40本书
|
|
|
handleBookCode(code) {
|
|
|
if (code == 1) {
|
|
|
- this.bookList.push()
|
|
|
+ this.bookList.push();
|
|
|
}
|
|
|
- let tempKeys = ['tiredDialog', '', '', 'noInfoDialog', "notAcceptDialog", 'maxAcceptDialog',
|
|
|
- 'orderMaxNumDialog'
|
|
|
- ]
|
|
|
- let key = tempKeys[code]
|
|
|
+ let tempKeys = [
|
|
|
+ "tiredDialog",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "noInfoDialog",
|
|
|
+ "notAcceptDialog",
|
|
|
+ "maxAcceptDialog",
|
|
|
+ "orderMaxNumDialog",
|
|
|
+ ];
|
|
|
+ let key = tempKeys[code];
|
|
|
if (key) {
|
|
|
- this.$refs[key].openPopup()
|
|
|
+ this.$refs[key].openPopup();
|
|
|
}
|
|
|
},
|
|
|
//获取当前用户未提交订单 /api/token/order/lastOrder
|
|
|
getLastOrder() {
|
|
|
- uni.$u.http.get('/token/order/lastOrder').then(res => {
|
|
|
+ uni.$u.http.get("/token/order/lastOrder").then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- this.bookList = res.data?.orderDetailList ? res.data.orderDetailList.map(v => {
|
|
|
- v.orderId = res.data.orderId
|
|
|
- return v
|
|
|
- }) : []
|
|
|
+ this.orderInfo = res.data;
|
|
|
+ this.bookList = res.data?.orderDetailList
|
|
|
+ ? res.data.orderDetailList.map((v) => {
|
|
|
+ v.orderId = res.data.orderId;
|
|
|
+ return v;
|
|
|
+ })
|
|
|
+ : [];
|
|
|
+ this.serviceList = res.data.serviceList || [];
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
goToScannedBooks() {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages-home/pages/scaned-book'
|
|
|
- })
|
|
|
+ url: "/pages-home/pages/scaned-book",
|
|
|
+ });
|
|
|
},
|
|
|
goToRules() {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/rules/index'
|
|
|
- })
|
|
|
- },
|
|
|
- showServiceGuarantee() {
|
|
|
- this.$refs.serviceGuarantee.openPopup()
|
|
|
+ url: "/pages/rules/index",
|
|
|
+ });
|
|
|
},
|
|
|
goToInputISBN() {
|
|
|
- this.$refs.isbnPopup.openPopup()
|
|
|
- }
|
|
|
+ this.$refs.isbnPopup.openPopup();
|
|
|
+ },
|
|
|
+ handleStartSelling() {
|
|
|
+ // 标记已显示过温馨提示
|
|
|
+ uni.setStorageSync('kindReminderShown', true);
|
|
|
+ },
|
|
|
+
|
|
|
+ handleViewRules() {
|
|
|
+ // 可以在这里添加额外的逻辑,如果需要的话
|
|
|
+ },
|
|
|
},
|
|
|
onShow() {
|
|
|
+ // 获取上一个订单
|
|
|
setTimeout(() => {
|
|
|
- this.getLastOrder()
|
|
|
- }, 300)
|
|
|
- }
|
|
|
-}
|
|
|
+ this.getLastOrder();
|
|
|
+ }, 300);
|
|
|
+
|
|
|
+ // 显示温馨提示弹窗
|
|
|
+ if (!uni.getStorageSync('kindReminderShown')) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.kindReminder.openPopup();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.customer-service {
|
|
|
+ position: fixed;
|
|
|
+ width: 126rpx;
|
|
|
+ height: 140rpx;
|
|
|
+ bottom: 20%;
|
|
|
+ right: 0;
|
|
|
+ z-index: 9;
|
|
|
+ z-index: 999;
|
|
|
+ button {
|
|
|
+ height: max-content;
|
|
|
+ background-color: transparent;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
.container {
|
|
|
height: 100%;
|
|
|
position: relative;
|
|
|
@@ -271,12 +312,11 @@ export default {
|
|
|
|
|
|
padding-bottom: 130rpx;
|
|
|
|
|
|
-
|
|
|
.nav-title {
|
|
|
font-family: PingFang SC;
|
|
|
font-weight: bold;
|
|
|
font-size: 34rpx;
|
|
|
- color: #FFFFFF;
|
|
|
+ color: #ffffff;
|
|
|
padding-left: 40rpx;
|
|
|
}
|
|
|
}
|
|
|
@@ -288,7 +328,7 @@ export default {
|
|
|
color: #999999;
|
|
|
|
|
|
&.tip {
|
|
|
- color: #FF8A4B;
|
|
|
+ color: #ff8a4b;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -334,37 +374,27 @@ export default {
|
|
|
}
|
|
|
|
|
|
.isbn-btn {
|
|
|
- background-color: #FFFFFF;
|
|
|
- color: #4CD964;
|
|
|
- border: 3rpx solid #4CD964;
|
|
|
+ background-color: #ffffff;
|
|
|
+ color: #4cd964;
|
|
|
+ border: 3rpx solid #4cd964;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.scan-btn {
|
|
|
- background-color: #4CD964;
|
|
|
- color: #FFFFFF;
|
|
|
+ background-color: #4cd964;
|
|
|
+ color: #ffffff;
|
|
|
}
|
|
|
|
|
|
.next-btn {
|
|
|
margin: 0;
|
|
|
margin-left: 20rpx;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.service-icons {
|
|
|
- display: flex;
|
|
|
- justify-content: space-around;
|
|
|
- padding: 14rpx;
|
|
|
- background: #1F1303;
|
|
|
- box-sizing: border-box;
|
|
|
|
|
|
- .icon-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- font-family: Source Han Sans CN;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 24rpx;
|
|
|
- color: #FFF6ED;
|
|
|
+ &[aria-disabled="true"] {
|
|
|
+ background-color: #cccccc;
|
|
|
+ color: #ffffff;
|
|
|
+ opacity: 0.7;
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|