GoodsSale.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  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. useSystem="MALL"
  238. :ids="[1]"
  239. :buyList="buyList"
  240. :balance="balance"
  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. async mounted() {
  341. // 插入token
  342. if (browser().android || browser().iPhone) {
  343. this.headerStatus = false;
  344. }
  345. await 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) {
  454. this.refundStatus = true;
  455. this.hashState();
  456. return;
  457. }
  458. let form = {
  459. studentId: this.studentId,
  460. goodsList: JSON.stringify(this.goodsList),
  461. addressInfo: JSON.stringify(this.addressInfo),
  462. // marketAmount: this.marketAmount ? this.marketAmount : 0,
  463. // couponIdList: this.obj.couponIdList,
  464. };
  465. let formCheckChange = false;
  466. let tempForm = this.tempForm;
  467. // 判断是否修改过内容
  468. if (
  469. form.studentId == tempForm.studentId &&
  470. form.goodsList == tempForm.goodsList &&
  471. form.addressInfo == tempForm.addressInfo
  472. // form.marketAmount == tempForm.marketAmount &&
  473. // JSON.stringify(form.couponList) == JSON.stringify(tempForm.couponList)
  474. ) {
  475. formCheckChange = true;
  476. }
  477. if (this.sGoodsOrderId && formCheckChange) {
  478. this.onPosterCode(this.sGoodsOrderId);
  479. } else {
  480. form.type = 1;
  481. this.tempForm = form;
  482. this.afterPayMent((res) => {
  483. this.sGoodsOrderId = res.data.pay.orderNo;
  484. this.onPosterCode(res.data.pay.orderNo);
  485. });
  486. }
  487. setTimeout(() => {
  488. this.isClick = false;
  489. }, 500);
  490. },
  491. onPosterCode(goodsId) {
  492. this.$refs.goodsOrder.style.filter = "blur(3px)";
  493. this.qrCodeStatus = true;
  494. let url =
  495. validStudentUrl() +
  496. "/#/goodsOrderBuyMall?id=" +
  497. goodsId +
  498. "&studentId=" +
  499. this.studentId;
  500. // console.log(url);
  501. this.config.value = url;
  502. // 可以点击下载按钮了
  503. this.downloadStatus = false;
  504. },
  505. async afterPayMent(callBack) {
  506. try {
  507. let goodsList = this.goodsList;
  508. // console.log(goodsList, this.addressInfo);
  509. const params = [];
  510. goodsList.forEach((good) => {
  511. params.push({
  512. price: good.groupPurchasePrice,
  513. productSkuId: good.id,
  514. quantity: good.goodsNum,
  515. productId: good.productId,
  516. hidden: 1,
  517. memberId: this.studentId,
  518. });
  519. });
  520. // 购买时,需要添加商品到购物车
  521. const carts = await mallCartAddAll(params);
  522. const cartConfirm = carts.data || [];
  523. const ids = cartConfirm.reduce((arr, value) => {
  524. arr.push(value.id);
  525. return arr;
  526. }, []);
  527. const body = {
  528. cartIds: ids,
  529. memberReceiveAddressId: this.addressInfo.id,
  530. userId: this.studentId,
  531. orderAmount: this.obj.amount,
  532. useBalance: this.obj.payType,
  533. couponId: this.obj.couponIdList.join(","),
  534. };
  535. const res = await mallGenerateOrder(body);
  536. if (res.data.orderType == "success") {
  537. this.$toast(res.msg);
  538. this.$router.push({
  539. path: "/paymentResult",
  540. query: {
  541. type: "on",
  542. isBack: "off",
  543. groupType: "MALL_BUY",
  544. },
  545. });
  546. } else {
  547. callBack && callBack(res);
  548. }
  549. } catch {
  550. //
  551. }
  552. },
  553. createPoster() {
  554. let tempImg = document.querySelector("#qrcode img");
  555. this.downloadUrl = tempImg.src;
  556. this.downloadfilename = "qrCode.png";
  557. this.$toast.loading({
  558. duration: 0, // 持续展示 toast
  559. forbidClick: true,
  560. message: "下载中...",
  561. });
  562. if (browser().android) {
  563. setTimeout(() => {
  564. this.$toast.clear();
  565. //a 标签下载
  566. this.$refs.download.click();
  567. }, 2000);
  568. } else if (browser().iPhone) {
  569. setTimeout(() => {
  570. this.$toast.clear();
  571. //a 标签下载
  572. window.webkit.messageHandlers.DAYA.postMessage(
  573. JSON.stringify({
  574. api: "downLoadImg",
  575. content: {
  576. downloadUrl: tempImg.src,
  577. },
  578. })
  579. );
  580. }, 2000);
  581. }
  582. },
  583. onClose() {
  584. this.$refs.goodsOrder.style.filter = "blur(0px)";
  585. },
  586. async onChangeStatus(val) {
  587. this.isStatus = val;
  588. await this.__init();
  589. this.obj = null;
  590. this.payType = false;
  591. this.calcPrice();
  592. },
  593. async onCheckSubmit() {
  594. if (!this.onCheckFiled()) {
  595. return;
  596. }
  597. // 确认退费规则
  598. if (!this.refundSure) {
  599. this.refundStatus = true;
  600. return;
  601. }
  602. this.afterPayMent((res) => {
  603. this.result = res.data.pay;
  604. this.onSubmit();
  605. });
  606. this.refundSure = false;
  607. },
  608. onCheckFiled() {
  609. if (!this.orderType) {
  610. this.$toast("请选择订单类型");
  611. return false;
  612. }
  613. if (this.goodsList.length <= 0) {
  614. this.$toast("请选择商品");
  615. return false;
  616. }
  617. // if (this.marketAmount) {
  618. // let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
  619. // if (!reg.test(this.marketAmount)) {
  620. // this.$toast("请选输入正确的减免金额");
  621. // return false;
  622. // }
  623. // }
  624. // if (
  625. // (this.payCountMoney - Number(this.marketAmount)).toFixed(2) <
  626. // this.groupPrice
  627. // ) {
  628. // this.$toast("减免后支付金额不能低于团购价");
  629. // return false;
  630. // }
  631. // if (this.payCountMoney - this.marketAmount < 0) {
  632. // this.$toast("减免金额不能大于总金额");
  633. // return false;
  634. // }
  635. if (!this.addressInfo.id) {
  636. this.$toast("请选择地址");
  637. return;
  638. }
  639. if (!this.agreeStatus) {
  640. this.$toast("请先阅读并同意《产品及服务协议》");
  641. return false;
  642. }
  643. return true;
  644. },
  645. onSubmit() {
  646. // submit 提交
  647. let result = this.result;
  648. if (result.type == "YQPAY") {
  649. let f = result.payMap;
  650. document.querySelector("#onSubmit").action = f.host;
  651. document.querySelector("#apiContent").value = f.apiContent;
  652. document.querySelector("#merNo").value = f.merNo;
  653. document.querySelector("#notifyUrl").value = f.notifyUrl;
  654. document.querySelector("#sign").value = f.sign;
  655. document.querySelector("#signType").value = f.signType;
  656. document.querySelector("#timestamp").value = f.timestamp;
  657. document.querySelector("#version").value = f.version;
  658. document.querySelector("#onSubmit").submit();
  659. } else if (result.type == "UNIONPAY") {
  660. localStorage.setItem("payInfo", JSON.stringify(result));
  661. this.$router.push({
  662. path: "/alipay",
  663. query: {
  664. balance: result.totalPrice,
  665. },
  666. });
  667. } else if (result.type == "ADAPAY") {
  668. this.payment = result;
  669. this.payMoney = result.payMap.amount;
  670. // 开始支付窗口
  671. this.isStatus = true;
  672. }
  673. },
  674. onClickCheckbox() {
  675. // 使用余额方法
  676. this.payType = !this.payType;
  677. this.calcPrice();
  678. },
  679. setCoupon(obj) {
  680. if (obj) {
  681. this.couponList = obj.couponList;
  682. this.valuePirce = obj.valuePirce;
  683. this.dataLists = obj.dataList;
  684. }
  685. this.calcPrice();
  686. },
  687. setNoMore() {
  688. this.calcPrice();
  689. },
  690. calcPrice() {
  691. let goodsList = this.goodsList;
  692. let tempPrice = 0;
  693. this.groupPrice = 0;
  694. this.buyList = [];
  695. this.moneyList = [];
  696. this.disCountList = [];
  697. goodsList.forEach((item) => {
  698. const price = Number((item.goodsNum * item.price).toFixed(2));
  699. this.buyList.push({
  700. name:
  701. item.goodsNum > 1 ? `${item.name} * ${item.goodsNum}` : item.name,
  702. type: "购买",
  703. price: price,
  704. couponType: "MALLCOUPON",
  705. });
  706. tempPrice += price;
  707. this.groupPrice += price;
  708. });
  709. // const couponType = {
  710. // FULL_REDUCTION: "满减",
  711. // DISCOUNT: "折扣",
  712. // };
  713. // if (this.dataLists && this.dataLists.length > 0) {
  714. // this.dataLists.forEach((item) => {
  715. // if (this.couponList.indexOf(item.couponCodeId) != -1) {
  716. // this.disCountList.push({
  717. // name: item.couponName,
  718. // type: couponType[item.couponType],
  719. // price: -item.faceValue.toFixed(2),
  720. // });
  721. // }
  722. // });
  723. // }
  724. // if (this.marketAmount > 0) {
  725. // this.buyList.push({
  726. // name: "减免金额",
  727. // type: "一次性",
  728. // price: -this.marketAmount,
  729. // couponType: "FULLCOUPON",
  730. // });
  731. // }
  732. this.payCountMoney = tempPrice;
  733. if (tempPrice - this.marketAmount <= 0) {
  734. tempPrice = 0;
  735. } else {
  736. tempPrice = Number((tempPrice - this.marketAmount).toFixed(2));
  737. }
  738. this.countMoney = tempPrice;
  739. tempPrice -= this.valuePirce;
  740. this.moneyList.push({ name: "应付金额", price: tempPrice });
  741. // 是否使用余额
  742. if (this.payType) {
  743. if (tempPrice - this.balance >= 0) {
  744. this.moneyList.push({ name: "余额支付", price: this.balance });
  745. tempPrice = Number((tempPrice - this.balance).toFixed(2));
  746. this.moneyList.push({ name: "现金支付", price: tempPrice });
  747. } else {
  748. this.moneyList.push({ name: "现金支付", price: 0 });
  749. this.moneyList.push({ name: "余额支付", price: tempPrice });
  750. tempPrice = 0;
  751. }
  752. } else {
  753. this.moneyList.push({ name: "余额支付", price: 0 });
  754. this.moneyList.push({ name: "现金支付", price: tempPrice });
  755. }
  756. this.payMoney = tempPrice;
  757. },
  758. },
  759. destroyed() {
  760. // 销毁页面时
  761. window.removeEventListener("hashchange", this.onHash, false);
  762. this.$toast.clear();
  763. this.qrCodeStatus = false;
  764. },
  765. };
  766. </script>
  767. <style lang="less" scoped>
  768. @import url("../../assets/commonLess/variable.less");
  769. .goodsOrder {
  770. min-height: 100vh;
  771. }
  772. .pay-name {
  773. // padding-left: 0.1rem;
  774. flex: 1 auto;
  775. font-weight: bold;
  776. }
  777. /deep/.van-cell-group {
  778. .van-cell {
  779. padding: 14px 16px;
  780. /deep/.van-cell__title {
  781. font-size: 0.17rem;
  782. color: @mFontColor;
  783. flex: 1 auto;
  784. width: 65%;
  785. }
  786. /deep/.van-cell__value {
  787. font-size: 0.17rem;
  788. flex: 1 auto;
  789. width: 50%;
  790. }
  791. }
  792. }
  793. /deep/.van-cell-group,
  794. .cell-address {
  795. margin-top: 0.12rem;
  796. }
  797. .textarea {
  798. flex-direction: column;
  799. /deep/.van-cell__value {
  800. padding-top: 0.1rem;
  801. flex: 1 auto;
  802. width: 100%;
  803. font-size: 0.15rem;
  804. color: #666;
  805. }
  806. /deep/.van-field__control {
  807. color: #666;
  808. }
  809. }
  810. /deep/.van-popup__close-icon--top-right {
  811. font-size: 0.24rem;
  812. color: #c0c0c0;
  813. top: 0.1rem;
  814. right: 0.1rem;
  815. }
  816. /deep/.van-stepper__input {
  817. background-color: #fff;
  818. }
  819. .pay-section {
  820. .van-checkbox {
  821. float: right;
  822. /deep/.van-checkbox__icon .van-icon {
  823. border-color: #aeb3c0;
  824. }
  825. /deep/.van-checkbox__icon--checked .van-icon {
  826. background-color: #01c1b5;
  827. border-color: #01c1b5;
  828. color: #fff;
  829. }
  830. }
  831. .van-cell__value {
  832. width: auto;
  833. }
  834. .logo {
  835. margin-right: 0.08rem;
  836. width: 0.24rem;
  837. height: 0.24rem;
  838. }
  839. }
  840. #qrcode {
  841. background: #fff;
  842. // padding: .05rem;
  843. margin: 10px auto 0;
  844. }
  845. .popup-qrcode {
  846. width: 80%;
  847. // width: 220px;
  848. padding: 0.2rem 0;
  849. border-radius: 0.05rem;
  850. text-align: center;
  851. .van-button--primary {
  852. margin-top: 0.1rem;
  853. }
  854. .loading-section {
  855. width: 100%;
  856. height: 100%;
  857. display: flex;
  858. align-items: center;
  859. justify-content: center;
  860. }
  861. }
  862. .button-group {
  863. margin: 0.3rem 0.26rem 0.2rem;
  864. .btn-sure {
  865. background: @mColor;
  866. border: 1px solid @mColor;
  867. font-size: 0.18rem;
  868. }
  869. .btn-qrcode {
  870. margin-top: 0.15rem;
  871. font-size: 0.18rem;
  872. background: transparent;
  873. }
  874. }
  875. .pay-value {
  876. color: #01c1b5;
  877. }
  878. .icon_close {
  879. position: absolute;
  880. right: 0.16rem;
  881. top: 0.16rem;
  882. font-size: 0.2rem;
  883. color: #929292;
  884. }
  885. .agreeProtocol {
  886. display: flex;
  887. align-items: center;
  888. color: #333333;
  889. margin-top: 0.1rem;
  890. padding: 0.05rem 0.16rem;
  891. font-size: 14px;
  892. line-height: 0.2rem;
  893. .van-checkbox {
  894. padding-right: 0.08rem;
  895. }
  896. /deep/.van-checkbox__icon .van-icon {
  897. background: #fff;
  898. }
  899. /deep/.van-checkbox__icon--checked .van-icon {
  900. color: #fff;
  901. background-color: #f85043;
  902. border-color: #f85043;
  903. }
  904. span {
  905. color: #01c1b5;
  906. }
  907. }
  908. .studentContainer {
  909. /deep/.van-cell-group {
  910. margin-top: 0;
  911. }
  912. /deep/.van-cell__title {
  913. font-size: 0.16rem;
  914. color: @mFontColor;
  915. flex: 1 auto;
  916. width: 70%;
  917. }
  918. .logo {
  919. width: 0.82rem;
  920. height: 0.82rem;
  921. margin-right: 0.12rem;
  922. border-radius: 0.05rem;
  923. overflow: hidden;
  924. }
  925. .input-cell {
  926. padding: 0.12rem 0.16rem;
  927. align-items: flex-start;
  928. .van-radio {
  929. justify-content: flex-end;
  930. }
  931. .price-section {
  932. display: flex;
  933. justify-content: space-between;
  934. align-items: center;
  935. del {
  936. font-size: 0.12rem;
  937. color: #666666;
  938. padding-left: 0.1rem;
  939. }
  940. }
  941. .money {
  942. color: #ff3535;
  943. font-weight: 600;
  944. font-size: 0.16rem;
  945. i {
  946. font-style: normal;
  947. font-size: 0.14rem;
  948. }
  949. }
  950. }
  951. /deep/.van-cell__value {
  952. height: 0.2rem;
  953. }
  954. .van-tag {
  955. margin-left: 0.08rem;
  956. }
  957. .content {
  958. display: flex;
  959. align-items: flex-start;
  960. justify-content: space-between;
  961. .name {
  962. // display: flex;
  963. // align-items: center;
  964. }
  965. .operation {
  966. font-size: 0.13rem;
  967. color: #999;
  968. display: flex;
  969. align-items: center;
  970. width: 1.2rem;
  971. justify-content: flex-end;
  972. .icon_del {
  973. display: inline-block;
  974. width: 0.13rem;
  975. height: 0.13rem;
  976. background: url("../../assets/images/icon_del.png") no-repeat center;
  977. background-size: contain;
  978. margin-right: 0.02rem;
  979. }
  980. }
  981. }
  982. }
  983. .cell-address {
  984. align-items: center;
  985. /deep/.van-cell__title {
  986. margin-left: 14px;
  987. }
  988. img {
  989. width: 0.2rem;
  990. height: 0.2rem;
  991. }
  992. }
  993. </style>