index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  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. };
  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. };
  319. } else {
  320. return {
  321. title: "书嗨",
  322. page: "/pages/home/index",
  323. };
  324. }
  325. },
  326. onReady() {
  327. // 获取屏幕宽度和高度
  328. uni.getSystemInfo({
  329. success: (res) => {
  330. this.screenWidth = res.windowWidth;
  331. this.screenHeight = res.windowHeight;
  332. },
  333. });
  334. setTimeout(() => {
  335. let loginSuccess = uni.getStorageSync("loginSuccess");
  336. let upsellCode = app.globalData.upsellCode;
  337. if (loginSuccess && upsellCode) {
  338. console.log(loginSuccess, "登录成功loginSuccess");
  339. this.$refs.shareRef?.open(upsellCode);
  340. uni.removeStorageSync("loginSuccess");
  341. this.getLastOrder();
  342. }
  343. }, 1000);
  344. },
  345. methods: {
  346. //删除书籍
  347. handleDeleteBook(book) {
  348. this.deleteBook = book;
  349. this.$refs.deleteDialog.openPopup(book);
  350. },
  351. //支付宝小程序的客服
  352. navigateToCustomerService() {
  353. uni.navigateTo({
  354. url: '/pages-mine/pages/customer-service'
  355. });
  356. },
  357. confirmDelete() {
  358. uni.$u.http
  359. .post("/token/order/removeBook", {
  360. orderId: this.deleteBook.orderId,
  361. isbn: this.deleteBook.isbn,
  362. })
  363. .then((res) => {
  364. if (res.code == 200) {
  365. this.$u.toast("删除成功");
  366. this.getLastOrder();
  367. }
  368. });
  369. },
  370. //扫码助力
  371. handleScanCode(data = {}) {
  372. this.$refs.upsellQrcodeRef.open(data);
  373. },
  374. slientLogin() {
  375. let inviteCode = uni.getStorageSync("inviteCode") || "";
  376. let token = uni.getStorageSync("token");
  377. if (token) return;
  378. uni.login({
  379. success(res) {
  380. uni.$u.http
  381. .post("/user/wxLogin", {
  382. code: res.code,
  383. inviteCode,
  384. })
  385. .then((response) => {
  386. if (response.code == 200) {
  387. uni.setStorageSync(
  388. "token",
  389. response.data.token
  390. );
  391. }
  392. });
  393. },
  394. fail: (err) => {
  395. console.log(err, "wx.login登录失败");
  396. },
  397. });
  398. },
  399. //查看活动规则
  400. handleViewSellRules() {
  401. this.$refs.upsellRulesRef.open();
  402. },
  403. // 触摸开始
  404. touchStart(e) {
  405. const touch = e.touches[0];
  406. this.startX = touch.clientX;
  407. this.startY = touch.clientY;
  408. // 记录初始位置,用于计算移动距离
  409. if (this.servicePosition.right !== "auto") {
  410. // 如果是靠右定位,记录当前位置但不立即改变显示位置
  411. // 只在内部计算中使用,避免视觉上的位置跳动
  412. this.initialLeft = this.screenWidth - 126;
  413. } else {
  414. this.initialLeft = parseFloat(this.servicePosition.left);
  415. }
  416. // 如果bottom是百分比,转换为具体像素值,但不改变显示位置
  417. if (
  418. typeof this.servicePosition.bottom === "string" &&
  419. this.servicePosition.bottom.includes("%")
  420. ) {
  421. const percentage =
  422. parseFloat(this.servicePosition.bottom) / 100;
  423. this.initialBottom = this.screenHeight * percentage;
  424. } else {
  425. this.initialBottom = parseFloat(this.servicePosition.bottom);
  426. }
  427. },
  428. // 触摸移动
  429. touchMove(e) {
  430. // 阻止默认行为,防止页面滚动
  431. e.preventDefault && e.preventDefault();
  432. e.stopPropagation && e.stopPropagation();
  433. const touch = e.touches[0];
  434. // 计算移动距离
  435. const deltaX = touch.clientX - this.startX;
  436. const deltaY = touch.clientY - this.startY;
  437. // 使用初始位置计算新位置,避免累积误差
  438. let newLeft = this.initialLeft + deltaX;
  439. let newBottom = this.initialBottom - deltaY; // 注意:y轴方向是相反的
  440. // 确保按钮不超出屏幕边界
  441. if (newLeft < 0) {
  442. newLeft = 0;
  443. } else if (newLeft > this.screenWidth - 126) {
  444. newLeft = this.screenWidth - 126;
  445. }
  446. // 确保按钮不超出屏幕垂直边界
  447. if (newBottom < 20) {
  448. newBottom = 20;
  449. } else if (newBottom > this.screenHeight - 160) {
  450. newBottom = this.screenHeight - 160;
  451. }
  452. // 使用节流方式更新位置,避免过于频繁的更新
  453. if (!this.isUpdatingPosition) {
  454. this.isUpdatingPosition = true;
  455. // 更新位置 - 第一次移动时才真正改变right为auto
  456. this.servicePosition = {
  457. left: newLeft,
  458. right: "auto",
  459. bottom: newBottom,
  460. };
  461. // 使用setTimeout代替requestAnimationFrame,在微信小程序中更兼容
  462. setTimeout(() => {
  463. this.isUpdatingPosition = false;
  464. }, 16); // 约等于60fps的刷新率
  465. }
  466. // 不更新起始点,保持相对于初始触摸点的位移计算
  467. // 这样可以避免累积误差,使拖动更精确
  468. },
  469. // 触摸结束,实现吸附效果
  470. touchEnd() {
  471. // 确保不再有待处理的更新
  472. this.isUpdatingPosition = false;
  473. const buttonCenter = this.servicePosition.left + 63; // 按钮中心位置
  474. const halfScreen = this.screenWidth / 2;
  475. // 判断是吸附到左边还是右边
  476. if (buttonCenter < halfScreen) {
  477. // 吸附到左边
  478. this.servicePosition = {
  479. left: 0,
  480. right: "auto",
  481. bottom: this.servicePosition.bottom,
  482. };
  483. } else {
  484. // 吸附到右边
  485. this.servicePosition = {
  486. left: "auto",
  487. right: 0,
  488. bottom: this.servicePosition.bottom,
  489. };
  490. }
  491. },
  492. handleStart() {
  493. this.showPopup = true;
  494. },
  495. //套装书确认
  496. handleSetBookConfirm() {
  497. this.$refs.confirmBooks.openPopup(this.currentBook);
  498. },
  499. //书册补全
  500. handleIncomplete() {
  501. this.$refs.scanBookList.handleDeleteBook(this.currentBook);
  502. },
  503. handleValidate() {
  504. if (this.bookList.some((v) => v.canInvite == 1)) {
  505. this.$refs.noUpsellDialog.openPopup();
  506. } else {
  507. this.onNext();
  508. }
  509. },
  510. //提交
  511. onNext() {
  512. let orderId = this.orderInfo.orderId;
  513. //预提交
  514. uni.$u.http
  515. .get("/token/order/preSubmit?orderId=" + orderId)
  516. .then((res) => {
  517. if (res.code == 200) {
  518. if (res.data.code == 1 || res.data.code == 2) {
  519. uni.navigateTo({
  520. url: "/pages-home/pages/book-order",
  521. });
  522. uni.setStorageSync("orderId", orderId);
  523. } else {
  524. uni.showToast({
  525. icon: "none",
  526. title: res.msg,
  527. });
  528. }
  529. } else {
  530. uni.showToast({
  531. icon: "none",
  532. title: res.msg,
  533. });
  534. }
  535. });
  536. },
  537. // 加价
  538. handleUpsell(book) {
  539. this.$refs.upsellRef.open(book);
  540. },
  541. updateBooksList(data, book) {
  542. this.bookList = data;
  543. // book.upsellMoney && this.getLastOrder();
  544. this.getLastOrder();
  545. },
  546. toggleCollapse(step) {
  547. this.$set(this.collapseState, step, !this.collapseState[step]);
  548. },
  549. handleScan() {
  550. uni.scanCode({
  551. scanType: ["barCode"],
  552. success: (res) => {
  553. this.checkBookISBN(res.result, "scan");
  554. },
  555. fail: () => {
  556. uni.showToast({
  557. title: "扫码失败",
  558. icon: "none",
  559. });
  560. },
  561. });
  562. },
  563. checkBookISBN(isbn, type) {
  564. let url =
  565. type == "input"
  566. ? `/token/order/inputIsbn?isbn=${isbn}`
  567. : `/token/order/scanIsbn?isbn=${isbn}`;
  568. uni.$u.http.get(url).then((res) => {
  569. if (res.code == 200) {
  570. let code = res.data.code;
  571. if (code == 1) {
  572. res.data.num = 1;
  573. res.data.status = 1;
  574. res.data.recyclePrice = res.data.recycleMoney;
  575. this.currentBook = res.data;
  576. this.bookList.unshift(res.data);
  577. if (res.data.suit == 1) {
  578. this.$refs.setBookDialog.openPopup();
  579. }
  580. if (res.data.canInvite == 1) {
  581. this.$refs.upsellRef.open(res.data);
  582. }
  583. } else if (code == 2) {
  584. let item = this.bookList.find((v) => v.isbn === isbn);
  585. item.num = item.num + 1;
  586. if (res.data.canInvite == 1) {
  587. this.$refs.upsellRef.open(res.data);
  588. }
  589. } else {
  590. this.handleBookCode(res.data.code);
  591. }
  592. } else {
  593. uni.showToast({
  594. title: res.msg,
  595. icon: "none",
  596. });
  597. }
  598. });
  599. },
  600. //处理扫码之后不同的状态 0-扫码频繁 1-成功 2-本单已有该书,数量+1 3-没有该书 4-本书暂不回收 5-超过每单最大可卖数量 6-单个订单最多40本书
  601. handleBookCode(code) {
  602. if (code == 1) {
  603. this.bookList.push();
  604. }
  605. let tempKeys = [
  606. "tiredDialog",
  607. "",
  608. "",
  609. "noInfoDialog",
  610. "notAcceptDialog",
  611. "maxAcceptDialog",
  612. "orderMaxNumDialog",
  613. ];
  614. let key = tempKeys[code];
  615. if (key) {
  616. this.$refs[key].openPopup();
  617. }
  618. },
  619. //获取当前用户未提交订单 /api/token/order/lastOrder
  620. getLastOrder() {
  621. uni.$u.http.get("/token/order/lastOrder").then((res) => {
  622. if (res.code == 200) {
  623. this.orderInfo = res.data;
  624. if (res.data.showDialog == 1) {
  625. this.$refs.firstOrderFreePopup.openPopup();
  626. } else if (res.data.showDialog == 2) {
  627. this.$refs.kindReminder.openPopup();
  628. }
  629. this.bookList = res.data?.orderDetailList
  630. ? res.data.orderDetailList.map((v) => {
  631. v.orderId = res.data.orderId;
  632. return v;
  633. })
  634. : [];
  635. this.serviceList = res.data.serviceList || [];
  636. }
  637. });
  638. },
  639. goToScannedBooks() {
  640. uni.navigateTo({
  641. url: "/pages-home/pages/scaned-book",
  642. });
  643. },
  644. goToInputISBN() {
  645. this.$refs.isbnPopup.openPopup();
  646. },
  647. handleStartSelling() {
  648. // 标记已显示过温馨提示
  649. uni.setStorageSync("kindReminderShown", true);
  650. },
  651. },
  652. onShow() {
  653. // 获取上一个订单
  654. setTimeout(() => {
  655. let token = uni.getStorageSync("token");
  656. token && this.getLastOrder();
  657. }, 300);
  658. },
  659. };
  660. </script>
  661. <style lang="scss" scoped>
  662. .customer-service {
  663. position: fixed;
  664. width: 126rpx;
  665. height: 140rpx;
  666. bottom: 20%;
  667. z-index: 999;
  668. transition: all 0.3s ease;
  669. /* 添加过渡效果使吸附更平滑 */
  670. button {
  671. height: max-content;
  672. background-color: transparent;
  673. padding: 0;
  674. }
  675. }
  676. .container {
  677. height: 100%;
  678. position: relative;
  679. overflow: auto;
  680. z-index: 1;
  681. /* #ifdef MP-WEIXIN */
  682. min-height: 100vh;
  683. /* #endif */
  684. /* #ifndef MP-WEIXIN */
  685. min-height: calc(100vh - 120rpx);
  686. /* #endif */
  687. &.book-list {
  688. padding-bottom: 300rpx;
  689. }
  690. padding-bottom: 130rpx;
  691. .nav-title {
  692. font-family: PingFang SC;
  693. font-weight: bold;
  694. font-size: 34rpx;
  695. color: #ffffff;
  696. padding-left: 40rpx;
  697. /* #ifdef MP-ALIPAY */
  698. padding-left: 70rpx;
  699. /* #endif */
  700. }
  701. }
  702. .common-text {
  703. font-family: PingFang SC;
  704. font-weight: 500;
  705. font-size: 28rpx;
  706. color: #999999;
  707. &.tip {
  708. color: #ff8a4b;
  709. }
  710. }
  711. .color-red {
  712. color: #ff0000;
  713. margin: 0 10rpx;
  714. }
  715. .color-green {
  716. color: #276f1e;
  717. }
  718. .bottom-fixed {
  719. position: fixed;
  720. left: 0;
  721. right: 0;
  722. bottom: 0;
  723. z-index: 9;
  724. background-color: #ffffff;
  725. /* #ifdef H5 */
  726. padding-bottom: 120rpx;
  727. /* #endif */
  728. .btn-wrap {
  729. display: flex;
  730. gap: 20rpx;
  731. padding: 20rpx;
  732. padding-bottom: 0;
  733. button {
  734. flex: 1;
  735. height: 88rpx;
  736. border-radius: 10rpx;
  737. display: flex;
  738. align-items: center;
  739. justify-content: center;
  740. gap: 10rpx;
  741. border: none;
  742. text {
  743. font-size: 32rpx;
  744. }
  745. &::after {
  746. border: none;
  747. }
  748. }
  749. .isbn-btn {
  750. background-color: #ffffff;
  751. color: #4cd964;
  752. border: 3rpx solid #4cd964;
  753. }
  754. }
  755. .scan-btn {
  756. background-color: #4cd964;
  757. color: #ffffff;
  758. }
  759. .next-btn {
  760. margin: 0;
  761. margin-left: 20rpx;
  762. &[aria-disabled="true"] {
  763. background-color: #cccccc;
  764. color: #ffffff;
  765. opacity: 0.7;
  766. cursor: not-allowed;
  767. }
  768. }
  769. }
  770. </style>