index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. <template>
  2. <view
  3. class="container"
  4. :style="{ background: containerBg }"
  5. :class="bookList.length ? 'book-list' : 'no-list'"
  6. >
  7. <u-navbar
  8. :is-back="false"
  9. :border-bottom="false"
  10. :background="{ background: navbarBackground }"
  11. >
  12. <text class="nav-title">卖书给书嗨</text>
  13. </u-navbar>
  14. <not-scanned v-if="!bookList.length"></not-scanned>
  15. <scan-book-list
  16. v-else
  17. @updateBooks="updateBooksList"
  18. @deleted="handleDeleteBook"
  19. :bookList="bookList"
  20. ref="scanBookList"
  21. @upsell="handleUpsell"
  22. @refresh="getLastOrder"
  23. ></scan-book-list>
  24. <!-- 底部固定按钮 -->
  25. <view class="bottom-fixed">
  26. <view class="btn-wrap mb-20">
  27. <button class="scan-btn flex-1" @click="handleScan">
  28. <u-icon name="scan" color="#FFFFFF" size="40"></u-icon>
  29. <text>扫码卖书</text>
  30. </button>
  31. <button class="isbn-btn flex-1" @click="goToInputISBN">
  32. <u-icon name="edit-pen" color="#4CD964" size="40"></u-icon>
  33. <text>输入ISBN</text>
  34. </button>
  35. </view>
  36. <view
  37. class="flex-a flex-j-b pad-20"
  38. style="padding-top: 0"
  39. v-if="bookList.length"
  40. >
  41. <view class="left-info" style="min-width: 194px">
  42. <view class="flex-a common-text">
  43. <text class="color-red">{{ orderInfo.totalNum }}</text>
  44. 件 预估回收价
  45. <text class="color-red"
  46. >¥{{ orderInfo.totalRecycleMoney || 0 }}</text
  47. >
  48. </view>
  49. <text class="common-text tip"
  50. >*旧书预估价格满
  51. {{ orderInfo.minOrderMoney }} 元起收</text
  52. >
  53. </view>
  54. <button
  55. class="scan-btn next-btn"
  56. @click="handleValidate"
  57. :disabled="isDisabled"
  58. >
  59. 下一步
  60. </button>
  61. </view>
  62. <service-info
  63. v-if="bookList.length"
  64. :serviceList="serviceList"
  65. :firstOrder="orderInfo.firstOrder"
  66. ></service-info>
  67. </view>
  68. <InputIsbn
  69. ref="isbnPopup"
  70. @submit="(isbn) => checkBookISBN(isbn, 'input')"
  71. />
  72. <!-- 套装书说明弹窗 -->
  73. <CommonDialog
  74. ref="setBookDialog"
  75. title="套装书说明"
  76. :showCancel="false"
  77. @confirm="handleSetBookConfirm"
  78. >
  79. <text
  80. >套装书(ISBN码相同的系列书箱)只需扫描其中一册,扫码价即套装价。打包时请把所有单册统在一起或放在一个袋子里寄出。</text
  81. >
  82. </CommonDialog>
  83. <!-- 暂不回收弹窗 -->
  84. <CommonDialog
  85. ref="notAcceptDialog"
  86. title="暂不回收"
  87. :showCancel="false"
  88. >
  89. <text>这本书暂时不回收,请您过段时间再来试试~</text>
  90. </CommonDialog>
  91. <!-- 暂无信息弹窗 -->
  92. <CommonDialog ref="noInfoDialog" title="暂无信息" :showCancel="false">
  93. <text
  94. >抱歉,没有该书的信息,书嗨会定期补充图书信息,请您过段时间再来试试~</text
  95. >
  96. </CommonDialog>
  97. <!-- 扫累了弹窗 -->
  98. <CommonDialog ref="tiredDialog" title="温馨提示" :showCancel="false">
  99. <text>扫累了,休息休息吧~</text>
  100. </CommonDialog>
  101. <!-- 该书超出最大回收本数 maxAcceptDialog-->
  102. <CommonDialog
  103. ref="maxAcceptDialog"
  104. title="温馨提示"
  105. :showCancel="false"
  106. >
  107. <text>该书超出最大回收本数</text>
  108. </CommonDialog>
  109. <!-- 单个订单最多40本书 orderMaxNumDialog-->
  110. <CommonDialog
  111. ref="orderMaxNumDialog"
  112. title="温馨提示"
  113. :showCancel="false"
  114. >
  115. <text>单个订单最多40本书</text>
  116. </CommonDialog>
  117. <!-- 删除活动书籍弹窗 -->
  118. <common-dialog
  119. ref="deleteDialog"
  120. title="温馨提示"
  121. @confirm="confirmDelete"
  122. >
  123. <text>{{
  124. deleteBook.upsellMoney
  125. ? "此书为限时加价收图书,删除后再次添加将失去加价收资格,确定删除吗?"
  126. : "确定删除这本图书吗?"
  127. }}</text>
  128. </common-dialog>
  129. <!-- 此订单还有未加价的图书,提交订单后将失去加价资格,确定提交吗? -->
  130. <common-dialog ref="noUpsellDialog" title="温馨提示" @confirm="onNext">
  131. <text
  132. >此订单还有未加价的图书,提交订单后将失去加价资格,确定提交吗?</text
  133. >
  134. </common-dialog>
  135. <!-- 温馨提示弹窗 -->
  136. <KindReminder
  137. ref="kindReminder"
  138. @start="handleStartSelling"
  139. @viewRules="handleViewRules"
  140. />
  141. <view
  142. class="customer-service"
  143. :style="{
  144. left: servicePosition.left + 'px',
  145. right: servicePosition.right + 'px',
  146. bottom: servicePosition.bottom + 'px',
  147. }"
  148. @touchstart="touchStart"
  149. @touchmove="touchMove"
  150. @touchend="touchEnd"
  151. >
  152. <!-- #ifdef MP-ALIPAY -->
  153. <button class="service-btn" @click="navigateToCustomerService">
  154. <image
  155. src="/static/img/kf.png"
  156. mode="widthFix"
  157. style="width: 126rpx; height: 140rpx"
  158. ></image>
  159. </button>
  160. <!-- #endif -->
  161. <!-- #ifndef MP-ALIPAY -->
  162. <button class="service-btn" open-type="contact">
  163. <image
  164. src="/static/img/kf.png"
  165. mode="widthFix"
  166. style="width: 126rpx; height: 140rpx"
  167. ></image>
  168. </button>
  169. <!-- #endif -->
  170. </view>
  171. <ConfirmBooks ref="confirmBooks" @incomplete="handleIncomplete" />
  172. <!-- 首单免费弹窗 -->
  173. <FirstOrderFreePopup ref="firstOrderFreePopup" />
  174. <!-- 图书加价弹窗 -->
  175. <UpsellBook ref="upsellRef" @scan="handleScanCode" />
  176. <!-- 加价分享弹窗 -->
  177. <UpsellShare ref="shareRef" @viewRules="handleViewSellRules" />
  178. <!-- 加价二维码弹窗 -->
  179. <UpsellQrcode ref="upsellQrcodeRef" />
  180. <!-- 加价规则弹窗 -->
  181. <UpsellRules ref="upsellRulesRef" />
  182. </view>
  183. </template>
  184. <script>
  185. import notScanned from "./components/notScanned.vue";
  186. import InputIsbn from "./components/InputIsbn.vue";
  187. import ScanBookList from "./components/ScanBookList.vue";
  188. import CommonDialog from "@/components/common-dialog.vue";
  189. import KindReminder from "./components/KindReminder.vue";
  190. import ServiceInfo from "./components/ServiceInfo.vue";
  191. import ConfirmBooks from "./components/ConfirmBooks.vue";
  192. import FirstOrderFreePopup from "./components/FirstOrderFreePopup.vue";
  193. import UpsellBook from "./components/upsell-book.vue";
  194. import UpsellRules from "./components/upsell-rules.vue";
  195. import UpsellShare from "./components/upsell-share.vue";
  196. import UpsellQrcode from "./components/upsell-qrcode.vue";
  197. import { silentLogin } from "@/api/auth";
  198. const app = getApp();
  199. export default {
  200. components: {
  201. notScanned,
  202. InputIsbn,
  203. ScanBookList,
  204. CommonDialog,
  205. KindReminder,
  206. ServiceInfo,
  207. ConfirmBooks,
  208. FirstOrderFreePopup,
  209. UpsellBook,
  210. UpsellRules,
  211. UpsellShare,
  212. UpsellQrcode,
  213. },
  214. data() {
  215. return {
  216. orderInfo: {},
  217. collapseState: {
  218. step1: false,
  219. step3: false,
  220. },
  221. scrollTop: 0,
  222. bookList: [],
  223. serviceList: [],
  224. currentBook: {},
  225. // 客服按钮位置
  226. servicePosition: {
  227. left: "auto",
  228. right: 0,
  229. bottom: "20%",
  230. },
  231. // 触摸开始位置
  232. startX: 0,
  233. startY: 0,
  234. // 屏幕宽度和高度
  235. screenWidth: 0,
  236. screenHeight: 0,
  237. // 初始位置记录,用于计算拖动
  238. initialLeft: 0,
  239. initialBottom: 0,
  240. // 是否正在更新位置,用于防止频繁更新
  241. isUpdatingPosition: false,
  242. shareData: {},
  243. deleteBook: {},
  244. };
  245. },
  246. computed: {
  247. navbarBackground() {
  248. if (this.scrollTop > 0) {
  249. return "linear-gradient(180deg, #4CD964 0%, #5ff178 100%)";
  250. }
  251. return "transparent";
  252. },
  253. containerBg() {
  254. return this.bookList.length > 0
  255. ? "linear-gradient(180deg, #4CD964 0%, #F8F8F8 25%)"
  256. : "linear-gradient(180deg, #4CD964 0%, #ffffff 25%)";
  257. },
  258. containerPb() {
  259. return this.bookList.length > 0 ? "300rpx" : "110rpx";
  260. },
  261. totalBooks() {
  262. return this.bookList.reduce(
  263. (sum, book) => sum + (book.num || 1),
  264. 0
  265. );
  266. },
  267. totalPrice() {
  268. return this.bookList
  269. .reduce(
  270. (sum, book) =>
  271. sum +
  272. book.recyclePrice * (book.num || 1) +
  273. book.currUpsellMoney || 0,
  274. 0
  275. )
  276. .toFixed(2);
  277. },
  278. isDisabled() {
  279. return this.totalPrice < this.orderInfo.minOrderMoney;
  280. },
  281. },
  282. onPageScroll(e) {
  283. this.$nextTick(() => {
  284. this.scrollTop = e.scrollTop;
  285. });
  286. },
  287. // 分享配置
  288. onShareAppMessage(res) {
  289. if (res.from === "button") {
  290. let upsellCode = uni.getStorageSync("upsellCodeShare");
  291. console.log(upsellCode, "分享");
  292. // 调用分享接口
  293. uni.$u.http.get("/token/order/goToShare?upsellCode=" + upsellCode);
  294. return {
  295. title: "书嗨",
  296. path: "/pages/home/index?upsellCode=" + upsellCode,
  297. imageUrl:
  298. "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
  299. desc: "书嗨,专注于书籍交易的平台,提供新书和二手书的买卖服务",
  300. };
  301. } else {
  302. return {
  303. title: "书嗨",
  304. page: "/pages/home/index",
  305. };
  306. }
  307. },
  308. // 分享到朋友圈
  309. onShareTimeline(res) {
  310. if (res.from === "button") {
  311. let upsellCode = uni.getStorageSync("upsellCodeShare");
  312. // 调用分享接口
  313. uni.$u.http.get("/token/order/goToShare?upsellCode=" + upsellCode);
  314. return {
  315. title: "书嗨",
  316. path: "/pages/home/index?upsellCode=" + upsellCode,
  317. imageUrl:
  318. "https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/share.jpg",
  319. desc: "书嗨,专注于书籍交易的平台,提供新书和二手书的买卖服务",
  320. };
  321. } else {
  322. return {
  323. title: "书嗨",
  324. page: "/pages/home/index",
  325. };
  326. }
  327. },
  328. onReady() {
  329. // 获取屏幕宽度和高度
  330. uni.getSystemInfo({
  331. success: (res) => {
  332. this.screenWidth = res.windowWidth;
  333. this.screenHeight = res.windowHeight;
  334. },
  335. });
  336. setTimeout(() => {
  337. let loginSuccess = uni.getStorageSync("loginSuccess");
  338. let upsellCode = app.globalData.upsellCode;
  339. if (loginSuccess && upsellCode) {
  340. console.log(loginSuccess, "登录成功loginSuccess");
  341. this.$refs.shareRef?.open(upsellCode);
  342. uni.removeStorageSync("loginSuccess");
  343. this.getLastOrder();
  344. }
  345. }, 1000);
  346. },
  347. methods: {
  348. //删除书籍
  349. handleDeleteBook(book) {
  350. this.deleteBook = book;
  351. this.$refs.deleteDialog.openPopup(book);
  352. },
  353. //支付宝小程序的客服
  354. navigateToCustomerService() {
  355. uni.navigateTo({
  356. url: '/pages-mine/pages/customer-service'
  357. });
  358. },
  359. confirmDelete() {
  360. uni.$u.http
  361. .post("/token/order/removeBook", {
  362. orderId: this.deleteBook.orderId,
  363. isbn: this.deleteBook.isbn,
  364. })
  365. .then((res) => {
  366. if (res.code == 200) {
  367. this.$u.toast("删除成功");
  368. this.getLastOrder();
  369. }
  370. });
  371. },
  372. //扫码助力
  373. handleScanCode(data = {}) {
  374. this.$refs.upsellQrcodeRef.open(data);
  375. },
  376. slientLogin() {
  377. let inviteCode = uni.getStorageSync("inviteCode") || "";
  378. let token = uni.getStorageSync("token");
  379. if (token) return;
  380. uni.login({
  381. success(res) {
  382. uni.$u.http
  383. .post("/user/wxLogin", {
  384. code: res.code,
  385. inviteCode,
  386. })
  387. .then((response) => {
  388. if (response.code == 200) {
  389. uni.setStorageSync(
  390. "token",
  391. response.data.token
  392. );
  393. }
  394. });
  395. },
  396. fail: (err) => {
  397. console.log(err, "wx.login登录失败");
  398. },
  399. });
  400. },
  401. //查看活动规则
  402. handleViewSellRules() {
  403. this.$refs.upsellRulesRef.open();
  404. },
  405. // 触摸开始
  406. touchStart(e) {
  407. const touch = e.touches[0];
  408. this.startX = touch.clientX;
  409. this.startY = touch.clientY;
  410. // 记录初始位置,用于计算移动距离
  411. if (this.servicePosition.right !== "auto") {
  412. // 如果是靠右定位,记录当前位置但不立即改变显示位置
  413. // 只在内部计算中使用,避免视觉上的位置跳动
  414. this.initialLeft = this.screenWidth - 126;
  415. } else {
  416. this.initialLeft = parseFloat(this.servicePosition.left);
  417. }
  418. // 如果bottom是百分比,转换为具体像素值,但不改变显示位置
  419. if (
  420. typeof this.servicePosition.bottom === "string" &&
  421. this.servicePosition.bottom.includes("%")
  422. ) {
  423. const percentage =
  424. parseFloat(this.servicePosition.bottom) / 100;
  425. this.initialBottom = this.screenHeight * percentage;
  426. } else {
  427. this.initialBottom = parseFloat(this.servicePosition.bottom);
  428. }
  429. },
  430. // 触摸移动
  431. touchMove(e) {
  432. // 阻止默认行为,防止页面滚动
  433. e.preventDefault && e.preventDefault();
  434. e.stopPropagation && e.stopPropagation();
  435. const touch = e.touches[0];
  436. // 计算移动距离
  437. const deltaX = touch.clientX - this.startX;
  438. const deltaY = touch.clientY - this.startY;
  439. // 使用初始位置计算新位置,避免累积误差
  440. let newLeft = this.initialLeft + deltaX;
  441. let newBottom = this.initialBottom - deltaY; // 注意:y轴方向是相反的
  442. // 确保按钮不超出屏幕边界
  443. if (newLeft < 0) {
  444. newLeft = 0;
  445. } else if (newLeft > this.screenWidth - 126) {
  446. newLeft = this.screenWidth - 126;
  447. }
  448. // 确保按钮不超出屏幕垂直边界
  449. if (newBottom < 20) {
  450. newBottom = 20;
  451. } else if (newBottom > this.screenHeight - 160) {
  452. newBottom = this.screenHeight - 160;
  453. }
  454. // 使用节流方式更新位置,避免过于频繁的更新
  455. if (!this.isUpdatingPosition) {
  456. this.isUpdatingPosition = true;
  457. // 更新位置 - 第一次移动时才真正改变right为auto
  458. this.servicePosition = {
  459. left: newLeft,
  460. right: "auto",
  461. bottom: newBottom,
  462. };
  463. // 使用setTimeout代替requestAnimationFrame,在微信小程序中更兼容
  464. setTimeout(() => {
  465. this.isUpdatingPosition = false;
  466. }, 16); // 约等于60fps的刷新率
  467. }
  468. // 不更新起始点,保持相对于初始触摸点的位移计算
  469. // 这样可以避免累积误差,使拖动更精确
  470. },
  471. // 触摸结束,实现吸附效果
  472. touchEnd() {
  473. // 确保不再有待处理的更新
  474. this.isUpdatingPosition = false;
  475. const buttonCenter = this.servicePosition.left + 63; // 按钮中心位置
  476. const halfScreen = this.screenWidth / 2;
  477. // 判断是吸附到左边还是右边
  478. if (buttonCenter < halfScreen) {
  479. // 吸附到左边
  480. this.servicePosition = {
  481. left: 0,
  482. right: "auto",
  483. bottom: this.servicePosition.bottom,
  484. };
  485. } else {
  486. // 吸附到右边
  487. this.servicePosition = {
  488. left: "auto",
  489. right: 0,
  490. bottom: this.servicePosition.bottom,
  491. };
  492. }
  493. },
  494. handleStart() {
  495. this.showPopup = true;
  496. },
  497. //套装书确认
  498. handleSetBookConfirm() {
  499. this.$refs.confirmBooks.openPopup(this.currentBook);
  500. },
  501. //书册补全
  502. handleIncomplete() {
  503. this.$refs.scanBookList.handleDeleteBook(this.currentBook);
  504. },
  505. handleValidate() {
  506. if (this.bookList.some((v) => v.canInvite == 1)) {
  507. this.$refs.noUpsellDialog.openPopup();
  508. } else {
  509. this.onNext();
  510. }
  511. },
  512. //提交
  513. onNext() {
  514. let orderId = this.orderInfo.orderId;
  515. //预提交
  516. uni.$u.http
  517. .get("/token/order/preSubmit?orderId=" + orderId)
  518. .then((res) => {
  519. if (res.code == 200) {
  520. if (res.data.code == 1 || res.data.code == 2) {
  521. uni.navigateTo({
  522. url: "/pages-home/pages/book-order",
  523. });
  524. uni.setStorageSync("orderId", orderId);
  525. } else {
  526. uni.showToast({
  527. icon: "none",
  528. title: res.msg,
  529. });
  530. }
  531. } else {
  532. uni.showToast({
  533. icon: "none",
  534. title: res.msg,
  535. });
  536. }
  537. });
  538. },
  539. // 加价
  540. handleUpsell(book) {
  541. this.$refs.upsellRef.open(book);
  542. },
  543. updateBooksList(data, book) {
  544. this.bookList = data;
  545. // book.upsellMoney && this.getLastOrder();
  546. this.getLastOrder();
  547. },
  548. toggleCollapse(step) {
  549. this.$set(this.collapseState, step, !this.collapseState[step]);
  550. },
  551. handleScan() {
  552. uni.scanCode({
  553. scanType: ["barCode"],
  554. success: (res) => {
  555. this.checkBookISBN(res.result, "scan");
  556. },
  557. fail: () => {
  558. uni.showToast({
  559. title: "扫码失败",
  560. icon: "none",
  561. });
  562. },
  563. });
  564. },
  565. checkBookISBN(isbn, type) {
  566. let url =
  567. type == "input"
  568. ? `/token/order/inputIsbn?isbn=${isbn}`
  569. : `/token/order/scanIsbn?isbn=${isbn}`;
  570. uni.$u.http.get(url).then((res) => {
  571. if (res.code == 200) {
  572. let code = res.data.code;
  573. if (code == 1) {
  574. res.data.num = 1;
  575. res.data.status = 1;
  576. res.data.recyclePrice = res.data.recycleMoney;
  577. this.currentBook = res.data;
  578. this.bookList.unshift(res.data);
  579. if (res.data.suit == 1) {
  580. this.$refs.setBookDialog.openPopup();
  581. }
  582. if (res.data.canInvite == 1) {
  583. this.$refs.upsellRef.open(res.data);
  584. }
  585. } else if (code == 2) {
  586. let item = this.bookList.find((v) => v.isbn === isbn);
  587. item.num = item.num + 1;
  588. if (res.data.canInvite == 1) {
  589. this.$refs.upsellRef.open(res.data);
  590. }
  591. } else {
  592. this.handleBookCode(res.data.code);
  593. }
  594. } else {
  595. uni.showToast({
  596. title: res.msg,
  597. icon: "none",
  598. });
  599. }
  600. });
  601. },
  602. //处理扫码之后不同的状态 0-扫码频繁 1-成功 2-本单已有该书,数量+1 3-没有该书 4-本书暂不回收 5-超过每单最大可卖数量 6-单个订单最多40本书
  603. handleBookCode(code) {
  604. if (code == 1) {
  605. this.bookList.push();
  606. }
  607. let tempKeys = [
  608. "tiredDialog",
  609. "",
  610. "",
  611. "noInfoDialog",
  612. "notAcceptDialog",
  613. "maxAcceptDialog",
  614. "orderMaxNumDialog",
  615. ];
  616. let key = tempKeys[code];
  617. if (key) {
  618. this.$refs[key].openPopup();
  619. }
  620. },
  621. //获取当前用户未提交订单 /api/token/order/lastOrder
  622. getLastOrder() {
  623. uni.$u.http.get("/token/order/lastOrder").then((res) => {
  624. if (res.code == 200) {
  625. this.orderInfo = res.data;
  626. if (res.data.showDialog == 1) {
  627. this.$refs.firstOrderFreePopup.openPopup();
  628. } else if (res.data.showDialog == 2) {
  629. this.$refs.kindReminder.openPopup();
  630. }
  631. this.bookList = res.data?.orderDetailList
  632. ? res.data.orderDetailList.map((v) => {
  633. v.orderId = res.data.orderId;
  634. return v;
  635. })
  636. : [];
  637. this.serviceList = res.data.serviceList || [];
  638. }
  639. });
  640. },
  641. goToScannedBooks() {
  642. uni.navigateTo({
  643. url: "/pages-home/pages/scaned-book",
  644. });
  645. },
  646. goToInputISBN() {
  647. this.$refs.isbnPopup.openPopup();
  648. },
  649. handleStartSelling() {
  650. // 标记已显示过温馨提示
  651. uni.setStorageSync("kindReminderShown", true);
  652. },
  653. },
  654. onShow() {
  655. // 获取上一个订单
  656. setTimeout(() => {
  657. let token = uni.getStorageSync("token");
  658. token && this.getLastOrder();
  659. }, 300);
  660. },
  661. };
  662. </script>
  663. <style lang="scss" scoped>
  664. .customer-service {
  665. position: fixed;
  666. width: 126rpx;
  667. height: 140rpx;
  668. bottom: 20%;
  669. z-index: 999;
  670. transition: all 0.3s ease;
  671. /* 添加过渡效果使吸附更平滑 */
  672. button {
  673. height: max-content;
  674. background-color: transparent;
  675. padding: 0;
  676. }
  677. }
  678. .container {
  679. height: 100%;
  680. position: relative;
  681. overflow: auto;
  682. z-index: 1;
  683. /* #ifdef MP-WEIXIN */
  684. min-height: 100vh;
  685. /* #endif */
  686. /* #ifndef MP-WEIXIN */
  687. min-height: calc(100vh - 120rpx);
  688. /* #endif */
  689. &.book-list {
  690. padding-bottom: 300rpx;
  691. }
  692. padding-bottom: 130rpx;
  693. .nav-title {
  694. font-family: PingFang SC;
  695. font-weight: bold;
  696. font-size: 34rpx;
  697. color: #ffffff;
  698. padding-left: 40rpx;
  699. /* #ifdef MP-ALIPAY */
  700. padding-left: 70rpx;
  701. /* #endif */
  702. }
  703. }
  704. .common-text {
  705. font-family: PingFang SC;
  706. font-weight: 500;
  707. font-size: 28rpx;
  708. color: #999999;
  709. &.tip {
  710. color: #ff8a4b;
  711. }
  712. }
  713. .color-red {
  714. color: #ff0000;
  715. margin: 0 10rpx;
  716. }
  717. .color-green {
  718. color: #276f1e;
  719. }
  720. .bottom-fixed {
  721. position: fixed;
  722. left: 0;
  723. right: 0;
  724. bottom: 0;
  725. z-index: 9;
  726. background-color: #ffffff;
  727. /* #ifdef H5 */
  728. padding-bottom: 120rpx;
  729. /* #endif */
  730. .btn-wrap {
  731. display: flex;
  732. gap: 20rpx;
  733. padding: 20rpx;
  734. padding-bottom: 0;
  735. button {
  736. flex: 1;
  737. height: 88rpx;
  738. border-radius: 10rpx;
  739. display: flex;
  740. align-items: center;
  741. justify-content: center;
  742. gap: 10rpx;
  743. border: none;
  744. text {
  745. font-size: 32rpx;
  746. }
  747. &::after {
  748. border: none;
  749. }
  750. }
  751. .isbn-btn {
  752. background-color: #ffffff;
  753. color: #4cd964;
  754. border: 3rpx solid #4cd964;
  755. }
  756. }
  757. .scan-btn {
  758. background-color: #4cd964;
  759. color: #ffffff;
  760. }
  761. .next-btn {
  762. margin: 0;
  763. margin-left: 20rpx;
  764. &[aria-disabled="true"] {
  765. background-color: #cccccc;
  766. color: #ffffff;
  767. opacity: 0.7;
  768. cursor: not-allowed;
  769. }
  770. }
  771. }
  772. </style>