GoodsSale.vue 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <div class="goodsOrder">
  3. <div ref="goodsOrder">
  4. <m-header :backUrl="backUrl" />
  5. <van-cell-group>
  6. <van-field
  7. readonly
  8. clickable
  9. label="订单类型"
  10. :value="orderText"
  11. input-align="right"
  12. placeholder="选择类型"
  13. @click="showPicker = true"
  14. />
  15. <van-popup v-model="showPicker" round position="bottom">
  16. <van-picker
  17. show-toolbar
  18. :columns="columns"
  19. @cancel="showPicker = false"
  20. @confirm="onConfirm"
  21. />
  22. </van-popup>
  23. <van-field
  24. :readonly="true"
  25. label="学生姓名"
  26. v-model="studentName"
  27. placeholder="请输入学生姓名"
  28. input-align="right"
  29. />
  30. <van-field
  31. label="选择商品"
  32. :readonly="true"
  33. @click="
  34. () => {
  35. goodsStatus = true;
  36. hashState('goods');
  37. }
  38. "
  39. is-link
  40. placeholder="选择商品"
  41. input-align="right"
  42. />
  43. <div class="studentContainer">
  44. <van-cell
  45. v-for="(item, index) in goodsList"
  46. :key="index"
  47. class="input-cell"
  48. :center="true"
  49. >
  50. <template slot="icon">
  51. <van-image class="logo" :src="item.pic" alt="" />
  52. </template>
  53. <template slot="title">
  54. <div class="content">
  55. <div class="name">
  56. <span style="vertical-align: middle; line-height: 0.16rem">{{
  57. item.name
  58. }}</span>
  59. <van-tag
  60. plain
  61. color="#C2A076"
  62. style="
  63. margin-left: 0;
  64. padding: 0.01rem 0.03rem;
  65. margin-right: 0.05rem;
  66. "
  67. >品牌:{{ item.brandName }}</van-tag
  68. >
  69. </div>
  70. <div class="operation" @click="onGoodDel(goodsList, item)">
  71. <i class="icon_del"></i>删除
  72. </div>
  73. </div>
  74. <p style="padding: 0.02rem 0; font-size: 0.14rem; color: #808080">
  75. 型号:{{ item.productSn }}
  76. </p>
  77. <div class="price-section">
  78. <div>
  79. <span class="money"
  80. ><span style="font-weight: 400; font-size: 0.14rem"
  81. >现价:</span
  82. ><i>¥</i>{{ item.price | moneyFormat }}</span
  83. ><del>原价:¥{{ item.originalPrice | moneyFormat }}</del>
  84. </div>
  85. <div style="font-size: 0.14rem; color: #808080">
  86. ×{{ item.goodsNum }}
  87. </div>
  88. </div>
  89. </template>
  90. </van-cell>
  91. </div>
  92. </van-cell-group>
  93. <van-cell @click="addressStatus = true" class="cell-address" is-link>
  94. <template #icon>
  95. <img src="./images/icon-address.png" />
  96. </template>
  97. <template #title>
  98. <div v-if="addressInfo.id">
  99. <span class="userName">{{ addressInfo.name }}</span>
  100. <span class="phone">
  101. {{
  102. addressInfo.phoneNumber &&
  103. addressInfo.phoneNumber.replace(
  104. /^(\d{3})\d{4}(\d+)/,
  105. "$1****$2"
  106. )
  107. }}
  108. </span>
  109. </div>
  110. <div class="emtry" v-else>请选择收货地址</div>
  111. </template>
  112. <template #label v-if="addressInfo.id">
  113. <span class="addressInfo"
  114. >{{ addressInfo.province }} {{ addressInfo.city }}
  115. {{ addressInfo.region }} {{ addressInfo.detailAddress }}</span
  116. >
  117. </template>
  118. </van-cell>
  119. <!-- 是否用余额支付 支付金额大于0时才会显示是否用余额支付 -->
  120. <van-cell-group class="pay-section">
  121. <van-cell
  122. :disabled="false"
  123. title="总价格"
  124. title-class="pay-name"
  125. value-class="pay-value"
  126. :center="true"
  127. >
  128. <template #default> ¥{{ payCountMoney | moneyFormat }} </template>
  129. </van-cell>
  130. <!-- <van-field
  131. label="减免金额"
  132. @input="setNoMore"
  133. v-model="marketAmount"
  134. type="number"
  135. ref="marketInput"
  136. placeholder="请输入减免金额"
  137. input-align="right"
  138. /> -->
  139. </van-cell-group>
  140. <protocol
  141. v-model="agreeStatus"
  142. :userId="studentId + ''"
  143. style="padding-top: 0.08rem"
  144. />
  145. <div class="button-group">
  146. <van-button
  147. class="btn-sure"
  148. type="primary"
  149. @click="onRefundSure(obj)"
  150. round
  151. size="large"
  152. >确认</van-button
  153. >
  154. </div>
  155. </div>
  156. <van-popup
  157. class="popup-qrcode"
  158. v-model="qrCodeStatus"
  159. closeable
  160. close-icon="cross"
  161. @close="onClose"
  162. >
  163. <div id="qrcode">
  164. <vue-qr
  165. :logoSrc="config.imagePath"
  166. :text="config.value"
  167. :margin="10"
  168. :size="220"
  169. ></vue-qr>
  170. </div>
  171. <a
  172. id="tt"
  173. ref="download"
  174. v-show="false"
  175. :href="downloadUrl"
  176. :download="downloadfilename"
  177. ></a>
  178. <!-- <p>点击图片进行下载</p> -->
  179. <van-button
  180. v-if="!headerStatus"
  181. color="#01C1B5"
  182. :disabled="downloadStatus"
  183. type="primary"
  184. @click="createPoster"
  185. round
  186. >下载二维码</van-button
  187. >
  188. </van-popup>
  189. <!-- 商品 -->
  190. <van-popup
  191. v-model="goodsStatus"
  192. :lock-scroll="true"
  193. position="bottom"
  194. :style="{ height: '100%', borderRadius: '0', overflowY: 'auto' }"
  195. >
  196. <GoodsList v-model="goodsStatus" @getChoiceGood="getChoiceGood" />
  197. </van-popup>
  198. <!-- 选择地址 -->
  199. <van-action-sheet
  200. v-model="addressStatus"
  201. title="选择地址"
  202. :style="{ height: '60%' }"
  203. >
  204. <AddAddress
  205. v-model="addressStatus"
  206. :addressInfo="addressInfo"
  207. :userId="studentId"
  208. @onDetail="
  209. (item) => {
  210. addressInfo = item;
  211. }
  212. "
  213. />
  214. </van-action-sheet>
  215. <!-- 协议 -->
  216. <van-popup
  217. id="protocolPopup"
  218. v-model="popupStatus"
  219. position="bottom"
  220. style="border-radius: 0 !important"
  221. >
  222. <m-protocol
  223. :protocolHTML="protocolHTML"
  224. @onClose="popupStatus = !popupStatus"
  225. @onPopupSure="popupStatus = !popupStatus"
  226. />
  227. </van-popup>
  228. <van-popup
  229. v-model="refundStatus"
  230. position="bottom"
  231. v-if="refundStatus"
  232. style="border-radius: 0 !important"
  233. >
  234. <m-refund
  235. @onClose="refundStatus = !refundStatus"
  236. @onPopupSure="onRefundSure"
  237. :ids="[1]"
  238. :showCoupon="false"
  239. :buyList="buyList"
  240. :balance="0"
  241. />
  242. <!-- :balance="this.orderType == 1 ? balance : 0" -->
  243. </van-popup>
  244. <m-payment
  245. :closeStatus="isStatus"
  246. :amount="payMoney"
  247. :payment="payment"
  248. @onChangeStatus="onChangeStatus"
  249. />
  250. </div>
  251. </template>
  252. <script>
  253. import GoodsList from "./model/goodsList";
  254. import AddAddress from "./model/addAddress";
  255. import MHeader from "@/components/header";
  256. import MPayment from "@/components/MPayment";
  257. import Protocol from "@/components/Protocol";
  258. import MRefund from "@/components/MRefund";
  259. import { mallGenerateOrder, mallCartAddAll } from "./api";
  260. import { getUserCashAccount } from "../service/api";
  261. import { browser, validStudentUrl } from "@/common/util";
  262. import qs from "query-string";
  263. import VueQr from "vue-qr";
  264. export default {
  265. name: "teacherList",
  266. components: {
  267. MHeader,
  268. VueQr,
  269. MPayment,
  270. Protocol,
  271. MRefund,
  272. GoodsList,
  273. AddAddress,
  274. },
  275. data() {
  276. let query = this.$route.query;
  277. // 保存之前输入的内容
  278. return {
  279. couponObj: {
  280. INSTRUMENT: "MUSICAL",
  281. ACCESSORIES: "ACCESSORIES",
  282. TEACHING: "TEACHING",
  283. STAFF: "OTHER",
  284. },
  285. addressStatus: false,
  286. addressInfo: {}, // 选择的地址对象
  287. goodsStatus: false,
  288. dataList: [],
  289. radio: "1",
  290. studentId: query.studentId, // 学生编号
  291. organId: query.organId,
  292. studentName: query.studentName,
  293. goodsList: [],
  294. marketAmount: null,
  295. tempForm: {}, // 临时存数据
  296. payType: false, // 是否使用余额
  297. balance: 0, // 余额
  298. backUrl: {
  299. status: true,
  300. path: "/serviceStudent?type=shop",
  301. },
  302. isClick: false,
  303. downloadStatus: true,
  304. qrCodeStatus: false,
  305. downloadUrl: null,
  306. downloadfilename: null,
  307. sGoodsOrderId: null,
  308. config: {
  309. value: null, //显示的值、跳转的地址
  310. imagePath: require("../../assets/images/logo-s.png"), //中间logo的地址
  311. },
  312. headerStatus: true,
  313. isStatus: false,
  314. payment: {}, // 支付对象
  315. payMoney: 0,
  316. payCountAmount: 0,
  317. loading: false,
  318. refundStatus: false,
  319. refundSure: false, // 是否确认退费规则
  320. buyList: [],
  321. disCountList: [],
  322. moneyList: [],
  323. payCountMoney: 0,
  324. protocolHTML: null,
  325. agreeStatus: false,
  326. popupStatus: false,
  327. couponShow: false,
  328. couponList: [],
  329. valuePirce: 0,
  330. dataLists: [],
  331. countMoney: 0,
  332. groupPrice: 0,
  333. obj: null,
  334. showPicker: false,
  335. columns: ["老师代买", "创建订单"],
  336. orderType: null,
  337. orderText: null,
  338. };
  339. },
  340. mounted() {
  341. // 插入token
  342. if (browser().android || browser().iPhone) {
  343. this.headerStatus = false;
  344. }
  345. this.__init();
  346. window.addEventListener("hashchange", this.onHash, false);
  347. },
  348. methods: {
  349. onHash() {
  350. this.refundStatus = false;
  351. this.goodsStatus = false;
  352. },
  353. hashState(status) {
  354. // 打开弹窗
  355. const type = status === "goods" ? this.goodsStatus : this.refundStatus;
  356. if (type) {
  357. this.isDestroy = false;
  358. const splitUrl = window.location.hash.slice(1).split("?");
  359. const query = qs.parse(splitUrl[1]);
  360. let times = 0;
  361. for (let key in query) {
  362. times++;
  363. }
  364. const origin = window.location.href;
  365. const url = times > 0 ? "&cPop=" + +new Date() : "?cPop=" + +new Date();
  366. history.pushState("", "", `${origin}${url}`);
  367. } else {
  368. const splitUrl = window.location.hash.slice(1).split("?");
  369. const query = qs.parse(splitUrl[1]);
  370. if (query.cPop) {
  371. window.history.go(-1);
  372. }
  373. }
  374. },
  375. onConfirm(value, index) {
  376. this.orderText = value;
  377. if (index == 0) {
  378. this.orderType = 1;
  379. } else if (index == 1) {
  380. this.orderType = 2;
  381. } else {
  382. this.orderType = null;
  383. }
  384. this.showPicker = false;
  385. },
  386. onRefundSure(obj) {
  387. if (obj) {
  388. this.refundStatus = false;
  389. this.refundSure = true;
  390. this.obj = obj;
  391. }
  392. // 第一次 判断是否
  393. if (this.orderType == 1) {
  394. this.onCheckSubmit();
  395. } else {
  396. this.onCreateCode();
  397. }
  398. },
  399. getChoiceGood(item) {
  400. let goodsList = this.goodsList;
  401. // console.log(item, "getChoiceGoods", goodsList);
  402. let status = false;
  403. let stockStatus = false;
  404. goodsList.forEach((good) => {
  405. if (good.id == item.id) {
  406. const num = good.goodsNum + item.goodsNum;
  407. if (num > item.stock) {
  408. this.$toast("库存不足");
  409. stockStatus = true;
  410. } else {
  411. status = true;
  412. good.goodsNum = good.goodsNum + item.goodsNum;
  413. }
  414. }
  415. });
  416. // 判断是否有同样的商品, 并库存够
  417. if (!status && !stockStatus) {
  418. goodsList.push(item);
  419. }
  420. this.goodsStatus = false;
  421. this.calcPrice();
  422. this.hashState("goods");
  423. },
  424. onGoodDel(goodsList, item) {
  425. this.$dialog
  426. .confirm({
  427. message: "确定删除该商品",
  428. confirmButtonColor: "#01C1B5",
  429. })
  430. .then(() => {
  431. let index = goodsList.indexOf(item);
  432. if (index !== -1) {
  433. goodsList.splice(index, 1);
  434. }
  435. // this.resetCoupon();
  436. this.calcPrice();
  437. });
  438. },
  439. async __init() {
  440. try {
  441. await getUserCashAccount({ id: this.studentId }).then((res) => {
  442. this.balance = res.data.balance || 0;
  443. });
  444. } catch {
  445. //
  446. }
  447. },
  448. async onCreateCode() {
  449. if (!this.onCheckFiled()) {
  450. return;
  451. }
  452. // 确认退费规则
  453. if (!this.refundSure && this.payCountMoney - this.marketAmount > 0) {
  454. this.refundStatus = true;
  455. this.hashState();
  456. return;
  457. }
  458. let form = {
  459. studentId: this.studentId,
  460. goodsList: JSON.stringify(this.goodsList),
  461. marketAmount: this.marketAmount ? this.marketAmount : 0,
  462. couponIdList: this.obj.couponIdList,
  463. };
  464. let formCheckChange = false;
  465. let tempForm = this.tempForm;
  466. // 判断是否修改过内容
  467. if (
  468. form.studentId == tempForm.studentId &&
  469. form.goodsList == tempForm.goodsList &&
  470. form.marketAmount == tempForm.marketAmount &&
  471. JSON.stringify(form.couponList) == JSON.stringify(tempForm.couponList)
  472. ) {
  473. formCheckChange = true;
  474. }
  475. if (this.sGoodsOrderId && formCheckChange) {
  476. this.onPosterCode(this.sGoodsOrderId);
  477. } else {
  478. form.type = 1;
  479. this.tempForm = form;
  480. this.afterPayMent((res) => {
  481. this.sGoodsOrderId = res.data.pay.orderNo;
  482. this.onPosterCode(res.data.pay.orderNo);
  483. });
  484. }
  485. setTimeout(() => {
  486. this.isClick = false;
  487. }, 500);
  488. },
  489. onPosterCode(goodsId) {
  490. this.$refs.goodsOrder.style.filter = "blur(3px)";
  491. this.qrCodeStatus = true;
  492. let url =
  493. validStudentUrl() +
  494. "/#/goodsOrderBuyMall?id=" +
  495. goodsId +
  496. "&studentId=" +
  497. this.studentId;
  498. // console.log(url);
  499. this.config.value = url;
  500. // 可以点击下载按钮了
  501. this.downloadStatus = false;
  502. },
  503. async afterPayMent(callBack) {
  504. try {
  505. let goodsList = this.goodsList;
  506. // console.log(goodsList, this.addressInfo);
  507. const params = [];
  508. goodsList.forEach((good) => {
  509. params.push({
  510. price: good.groupPurchasePrice,
  511. productSkuId: good.id,
  512. quantity: good.goodsNum,
  513. productId: good.productId,
  514. hidden: 1,
  515. memberId: this.studentId,
  516. });
  517. });
  518. // 购买时,需要添加商品到购物车
  519. const carts = await mallCartAddAll(params);
  520. const cartConfirm = carts.data || [];
  521. const ids = cartConfirm.reduce((arr, value) => {
  522. arr.push(value.id);
  523. return arr;
  524. }, []);
  525. const body = {
  526. cartIds: ids,
  527. memberReceiveAddressId: this.addressInfo.id,
  528. orderAmount: this.payCountMoney,
  529. userId: this.studentId,
  530. };
  531. const res = await mallGenerateOrder(body);
  532. if (res.data.orderType == "success") {
  533. this.$toast(res.msg);
  534. this.$router.push({
  535. path: "/paymentResult",
  536. query: {
  537. type: "on",
  538. isBack: "off",
  539. groupType: "GOODS_SELL",
  540. },
  541. });
  542. } else {
  543. callBack && callBack(res);
  544. }
  545. } catch {
  546. //
  547. }
  548. },
  549. createPoster() {
  550. let tempImg = document.querySelector("#qrcode img");
  551. this.downloadUrl = tempImg.src;
  552. this.downloadfilename = "qrCode.png";
  553. this.$toast.loading({
  554. duration: 0, // 持续展示 toast
  555. forbidClick: true,
  556. message: "下载中...",
  557. });
  558. if (browser().android) {
  559. setTimeout(() => {
  560. this.$toast.clear();
  561. //a 标签下载
  562. this.$refs.download.click();
  563. }, 2000);
  564. } else if (browser().iPhone) {
  565. setTimeout(() => {
  566. this.$toast.clear();
  567. //a 标签下载
  568. window.webkit.messageHandlers.DAYA.postMessage(
  569. JSON.stringify({
  570. api: "downLoadImg",
  571. content: {
  572. downloadUrl: tempImg.src,
  573. },
  574. })
  575. );
  576. }, 2000);
  577. }
  578. },
  579. onClose() {
  580. this.$refs.goodsOrder.style.filter = "blur(0px)";
  581. },
  582. async onChangeStatus(val) {
  583. this.isStatus = val;
  584. this.__init();
  585. this.payType = false;
  586. this.calcPrice();
  587. },
  588. async onCheckSubmit() {
  589. if (!this.onCheckFiled()) {
  590. return;
  591. }
  592. // 确认退费规则
  593. if (!this.refundSure && this.payCountMoney > 0) {
  594. this.refundStatus = true;
  595. return;
  596. }
  597. this.afterPayMent((res) => {
  598. this.result = res.data.pay;
  599. this.onSubmit();
  600. });
  601. this.refundSure = false;
  602. },
  603. onCheckFiled() {
  604. if (!this.orderType) {
  605. this.$toast("请选择订单类型");
  606. return false;
  607. }
  608. if (this.goodsList.length <= 0) {
  609. this.$toast("请选择商品");
  610. return false;
  611. }
  612. // if (this.marketAmount) {
  613. // let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
  614. // if (!reg.test(this.marketAmount)) {
  615. // this.$toast("请选输入正确的减免金额");
  616. // return false;
  617. // }
  618. // }
  619. // if (
  620. // (this.payCountMoney - Number(this.marketAmount)).toFixed(2) <
  621. // this.groupPrice
  622. // ) {
  623. // this.$toast("减免后支付金额不能低于团购价");
  624. // return false;
  625. // }
  626. // if (this.payCountMoney - this.marketAmount < 0) {
  627. // this.$toast("减免金额不能大于总金额");
  628. // return false;
  629. // }
  630. if (!this.addressInfo.id) {
  631. this.$toast("请选择地址");
  632. return;
  633. }
  634. if (!this.agreeStatus) {
  635. this.$toast("请先阅读并同意《产品及服务协议》");
  636. return false;
  637. }
  638. return true;
  639. },
  640. onSubmit() {
  641. // submit 提交
  642. let result = this.result;
  643. if (result.type == "YQPAY") {
  644. let f = result.payMap;
  645. document.querySelector("#onSubmit").action = f.host;
  646. document.querySelector("#apiContent").value = f.apiContent;
  647. document.querySelector("#merNo").value = f.merNo;
  648. document.querySelector("#notifyUrl").value = f.notifyUrl;
  649. document.querySelector("#sign").value = f.sign;
  650. document.querySelector("#signType").value = f.signType;
  651. document.querySelector("#timestamp").value = f.timestamp;
  652. document.querySelector("#version").value = f.version;
  653. document.querySelector("#onSubmit").submit();
  654. } else if (result.type == "UNIONPAY") {
  655. localStorage.setItem("payInfo", JSON.stringify(result));
  656. this.$router.push({
  657. path: "/alipay",
  658. query: {
  659. balance: result.totalPrice,
  660. },
  661. });
  662. } else if (result.type == "ADAPAY") {
  663. this.payment = result;
  664. this.payMoney = result.payMap.amount;
  665. // 开始支付窗口
  666. this.isStatus = true;
  667. }
  668. },
  669. onClickCheckbox() {
  670. // 使用余额方法
  671. this.payType = !this.payType;
  672. this.calcPrice();
  673. },
  674. setCoupon(obj) {
  675. if (obj) {
  676. this.couponList = obj.couponList;
  677. this.valuePirce = obj.valuePirce;
  678. this.dataLists = obj.dataList;
  679. }
  680. this.calcPrice();
  681. },
  682. setNoMore() {
  683. this.calcPrice();
  684. },
  685. calcPrice() {
  686. let goodsList = this.goodsList;
  687. let tempPrice = 0;
  688. this.groupPrice = 0;
  689. this.buyList = [];
  690. this.moneyList = [];
  691. this.disCountList = [];
  692. goodsList.forEach((item) => {
  693. const price = Number((item.goodsNum * item.price).toFixed(2));
  694. this.buyList.push({
  695. name:
  696. item.goodsNum > 1 ? `${item.name} * ${item.goodsNum}` : item.name,
  697. type: "购买",
  698. price: price,
  699. couponType: this.couponObj[item.type],
  700. });
  701. tempPrice += price;
  702. this.groupPrice += price;
  703. });
  704. // const couponType = {
  705. // FULL_REDUCTION: "满减",
  706. // DISCOUNT: "折扣",
  707. // };
  708. // if (this.dataLists && this.dataLists.length > 0) {
  709. // this.dataLists.forEach((item) => {
  710. // if (this.couponList.indexOf(item.couponCodeId) != -1) {
  711. // this.disCountList.push({
  712. // name: item.couponName,
  713. // type: couponType[item.couponType],
  714. // price: -item.faceValue.toFixed(2),
  715. // });
  716. // }
  717. // });
  718. // }
  719. // if (this.marketAmount > 0) {
  720. // this.buyList.push({
  721. // name: "减免金额",
  722. // type: "一次性",
  723. // price: -this.marketAmount,
  724. // couponType: "FULLCOUPON",
  725. // });
  726. // }
  727. this.payCountMoney = tempPrice;
  728. if (tempPrice - this.marketAmount <= 0) {
  729. tempPrice = 0;
  730. } else {
  731. tempPrice = Number((tempPrice - this.marketAmount).toFixed(2));
  732. }
  733. this.countMoney = tempPrice;
  734. tempPrice -= this.valuePirce;
  735. this.moneyList.push({ name: "应付金额", price: tempPrice });
  736. // 是否使用余额
  737. if (this.payType) {
  738. if (tempPrice - this.balance >= 0) {
  739. this.moneyList.push({ name: "余额支付", price: this.balance });
  740. tempPrice = Number((tempPrice - this.balance).toFixed(2));
  741. this.moneyList.push({ name: "现金支付", price: tempPrice });
  742. } else {
  743. this.moneyList.push({ name: "现金支付", price: 0 });
  744. this.moneyList.push({ name: "余额支付", price: tempPrice });
  745. tempPrice = 0;
  746. }
  747. } else {
  748. this.moneyList.push({ name: "余额支付", price: 0 });
  749. this.moneyList.push({ name: "现金支付", price: tempPrice });
  750. }
  751. this.payMoney = tempPrice;
  752. },
  753. },
  754. destroyed() {
  755. // 销毁页面时
  756. window.removeEventListener("hashchange", this.onHash, false);
  757. this.$toast.clear();
  758. this.qrCodeStatus = false;
  759. },
  760. };
  761. </script>
  762. <style lang="less" scoped>
  763. @import url("../../assets/commonLess/variable.less");
  764. .goodsOrder {
  765. min-height: 100vh;
  766. }
  767. .pay-name {
  768. // padding-left: 0.1rem;
  769. flex: 1 auto;
  770. font-weight: bold;
  771. }
  772. /deep/.van-cell-group {
  773. .van-cell {
  774. padding: 14px 16px;
  775. /deep/.van-cell__title {
  776. font-size: 0.17rem;
  777. color: @mFontColor;
  778. flex: 1 auto;
  779. width: 65%;
  780. }
  781. /deep/.van-cell__value {
  782. font-size: 0.17rem;
  783. flex: 1 auto;
  784. width: 50%;
  785. }
  786. }
  787. }
  788. /deep/.van-cell-group,
  789. .cell-address {
  790. margin-top: 0.12rem;
  791. }
  792. .textarea {
  793. flex-direction: column;
  794. /deep/.van-cell__value {
  795. padding-top: 0.1rem;
  796. flex: 1 auto;
  797. width: 100%;
  798. font-size: 0.15rem;
  799. color: #666;
  800. }
  801. /deep/.van-field__control {
  802. color: #666;
  803. }
  804. }
  805. /deep/.van-popup__close-icon--top-right {
  806. font-size: 0.24rem;
  807. color: #c0c0c0;
  808. top: 0.1rem;
  809. right: 0.1rem;
  810. }
  811. /deep/.van-stepper__input {
  812. background-color: #fff;
  813. }
  814. .pay-section {
  815. .van-checkbox {
  816. float: right;
  817. /deep/.van-checkbox__icon .van-icon {
  818. border-color: #aeb3c0;
  819. }
  820. /deep/.van-checkbox__icon--checked .van-icon {
  821. background-color: #01c1b5;
  822. border-color: #01c1b5;
  823. color: #fff;
  824. }
  825. }
  826. .van-cell__value {
  827. width: auto;
  828. }
  829. .logo {
  830. margin-right: 0.08rem;
  831. width: 0.24rem;
  832. height: 0.24rem;
  833. }
  834. }
  835. #qrcode {
  836. background: #fff;
  837. // padding: .05rem;
  838. margin: 10px auto 0;
  839. }
  840. .popup-qrcode {
  841. width: 80%;
  842. // width: 220px;
  843. padding: 0.2rem 0;
  844. border-radius: 0.05rem;
  845. text-align: center;
  846. .van-button--primary {
  847. margin-top: 0.1rem;
  848. }
  849. .loading-section {
  850. width: 100%;
  851. height: 100%;
  852. display: flex;
  853. align-items: center;
  854. justify-content: center;
  855. }
  856. }
  857. .button-group {
  858. margin: 0.3rem 0.26rem 0.2rem;
  859. .btn-sure {
  860. background: @mColor;
  861. border: 1px solid @mColor;
  862. font-size: 0.18rem;
  863. }
  864. .btn-qrcode {
  865. margin-top: 0.15rem;
  866. font-size: 0.18rem;
  867. background: transparent;
  868. }
  869. }
  870. .pay-value {
  871. color: #01c1b5;
  872. }
  873. .icon_close {
  874. position: absolute;
  875. right: 0.16rem;
  876. top: 0.16rem;
  877. font-size: 0.2rem;
  878. color: #929292;
  879. }
  880. .agreeProtocol {
  881. display: flex;
  882. align-items: center;
  883. color: #333333;
  884. margin-top: 0.1rem;
  885. padding: 0.05rem 0.16rem;
  886. font-size: 14px;
  887. line-height: 0.2rem;
  888. .van-checkbox {
  889. padding-right: 0.08rem;
  890. }
  891. /deep/.van-checkbox__icon .van-icon {
  892. background: #fff;
  893. }
  894. /deep/.van-checkbox__icon--checked .van-icon {
  895. color: #fff;
  896. background-color: #f85043;
  897. border-color: #f85043;
  898. }
  899. span {
  900. color: #01c1b5;
  901. }
  902. }
  903. .studentContainer {
  904. /deep/.van-cell-group {
  905. margin-top: 0;
  906. }
  907. /deep/.van-cell__title {
  908. font-size: 0.16rem;
  909. color: @mFontColor;
  910. flex: 1 auto;
  911. width: 70%;
  912. }
  913. .logo {
  914. width: 0.82rem;
  915. height: 0.82rem;
  916. margin-right: 0.12rem;
  917. border-radius: 0.05rem;
  918. overflow: hidden;
  919. }
  920. .input-cell {
  921. padding: 0.12rem 0.16rem;
  922. align-items: flex-start;
  923. .van-radio {
  924. justify-content: flex-end;
  925. }
  926. .price-section {
  927. display: flex;
  928. justify-content: space-between;
  929. align-items: center;
  930. del {
  931. font-size: 0.12rem;
  932. color: #666666;
  933. padding-left: 0.1rem;
  934. }
  935. }
  936. .money {
  937. color: #ff3535;
  938. font-weight: 600;
  939. font-size: 0.16rem;
  940. i {
  941. font-style: normal;
  942. font-size: 0.14rem;
  943. }
  944. }
  945. }
  946. /deep/.van-cell__value {
  947. height: 0.2rem;
  948. }
  949. .van-tag {
  950. margin-left: 0.08rem;
  951. }
  952. .content {
  953. display: flex;
  954. align-items: flex-start;
  955. justify-content: space-between;
  956. .name {
  957. // display: flex;
  958. // align-items: center;
  959. }
  960. .operation {
  961. font-size: 0.13rem;
  962. color: #999;
  963. display: flex;
  964. align-items: center;
  965. width: 1.2rem;
  966. justify-content: flex-end;
  967. .icon_del {
  968. display: inline-block;
  969. width: 0.13rem;
  970. height: 0.13rem;
  971. background: url("../../assets/images/icon_del.png") no-repeat center;
  972. background-size: contain;
  973. margin-right: 0.02rem;
  974. }
  975. }
  976. }
  977. }
  978. .cell-address {
  979. align-items: center;
  980. /deep/.van-cell__title {
  981. margin-left: 14px;
  982. }
  983. img {
  984. width: 0.2rem;
  985. height: 0.2rem;
  986. }
  987. }
  988. </style>