GoodsSale.vue 26 KB

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