index.vue 26 KB

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