sendOrderPopup.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. <template>
  2. <div>
  3. <el-dialog width="700px" :show-close="false" destroy-on-close :visible.sync="dialogTableVisible">
  4. <div class="send-content">
  5. <div class="top-juhe" @click.stop="changeDeliveryType" :class="{ active: deliveryType == 1 }">
  6. <div class="left-content">
  7. <div class="juhe-icon">
  8. <img src="../../../static/image/juhe-icon.png" />
  9. </div>
  10. <div>
  11. <div class="juhe-title">聚合配送</div>
  12. <div class="quan-wang">
  13. <span>{{ order.desc }}</span>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="right-content">
  18. <div class="right-title">
  19. 预估&nbsp;
  20. <span v-if="deliveryList && deliveryList.length > 1">{{ computedAmount >= 0 ? computedAmount : 0 }}~{{
  21. computedAmountMax >= 0 ? computedAmountMax : 0
  22. }}</span>
  23. <span v-if="deliveryList && deliveryList.length == 1">{{
  24. computedAmountOther >= 0 ? computedAmountOther : 0
  25. }}</span>
  26. <span v-if="deliveryList && deliveryList.length < 1">--</span>
  27. &nbsp;元
  28. </div>
  29. <div class="youhui" v-if="deliveryList.length >= 1">
  30. {{
  31. order.firstCoupon
  32. ? `新人首单立减${order.firstCoupon}元,`
  33. : ""
  34. }}优惠合计最高{{
  35. discount(
  36. deliveryList.length > 1
  37. ? computedAmountMax
  38. : computedAmountOther,
  39. tipAmount,
  40. couponPrice,
  41. Number(order.firstCoupon),
  42. 0
  43. )
  44. }}元
  45. </div>
  46. </div>
  47. <img v-if="deliveryType == 1" src="../../../static/image/choose-icon.png" class="choose-icon" />
  48. </div>
  49. <!-- 自选运力 -->
  50. <div class="choose-self">
  51. <div class="self-top">
  52. <img src="../../../static/image/choose-self-icon.png" class="choose-self-icon" />
  53. <span>自选运力</span>
  54. </div>
  55. <div class="delivery-list">
  56. <div class="delivery-list-item" @click.stop="deliveryItem(item)" v-for="(item, index) in deliveryList" :key="index">
  57. <div class="item-left">
  58. <div class="item-logo">
  59. <img :src="item.logo" />
  60. </div>
  61. <div>
  62. <div class="item-title">{{ item.name }}</div>
  63. <div class="item-miters">{{ item.desc }}</div>
  64. </div>
  65. </div>
  66. <div class="item-right">
  67. <div>
  68. <div class="item-price">
  69. 预估&nbsp;<span>{{
  70. computePrice(
  71. item.deliveryAmount,
  72. tipAmount,
  73. couponPrice,
  74. Number(order.firstCoupon),
  75. item.isMine
  76. )
  77. }}</span>&nbsp;元
  78. </div>
  79. <div v-if="
  80. !item.isMine &&
  81. item.deliveryAmount.toFixed(2) > couponParams.limitFee
  82. " class="item-coupon">
  83. {{
  84. order.firstCoupon
  85. ? `新人首单立减${order.firstCoupon}元,`
  86. : ""
  87. }}优惠合计{{
  88. discount(
  89. item.deliveryAmount,
  90. tipAmount,
  91. couponPrice,
  92. Number(order.firstCoupon),
  93. item.isMine
  94. )
  95. }}元
  96. </div>
  97. <div v-if="item.isMine" class="item-coupon">绑定的自运力</div>
  98. </div>
  99. <div class="item-choose">
  100. <img v-if="!item.isChoose" src="../../../static/image/item-choose-icon.png" />
  101. <img v-else src="../../../static/image/select_yes@2x.png" />
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- 选择优惠券 -->
  108. <div>
  109. <div class="choose-coupon">
  110. <div></div>
  111. <div class="coupon-box">
  112. <!-- <img src="../../../static/image/coupon-icon.png" class="coupon-icon" /> -->
  113. <el-select @change="chooseCoupon" v-model="coupon" placeholder="请选择使用优惠券">
  114. <el-option v-for="item in couponList" :key="item.id" :label="item.name" :value="item.id">
  115. <span style="float: left">{{ item.name }}</span>
  116. <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.num">x{{ item.num }}</span>
  117. </el-option>
  118. </el-select>
  119. <!-- <span>选择优惠券</span>
  120. <img src="../../../static/image/arrow-down.png" class="arrow-down" /> -->
  121. </div>
  122. </div>
  123. <!-- 预留优惠券列表 -->
  124. <div class="coupon-list"></div>
  125. </div>
  126. <!-- 支付方式 -->
  127. <div class="choose-self" style="border: none">
  128. <div class="self-top">
  129. <img src="../../../static/image/choose-self-icon.png" class="choose-self-icon" />
  130. <span>支付方式</span>
  131. </div>
  132. <div class="pay-list">
  133. <div class="pay-item" @click="payId = item.id" :class="payId == item.id ? 'pay-active' : ''" v-for="(item, index) in payList" :key="index">
  134. <img :src="item.icon" class="pay-icon" />
  135. <span>{{ item.name }}</span>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="btn-wrap">
  140. <el-button :loading="loading" type="primary" class="submit-btn" @click.stop="payMoney">确定支付</el-button>
  141. </div>
  142. </div>
  143. </el-dialog>
  144. <!-- 支付二维码弹出层 -->
  145. <qr-code v-if="showCode" @paySuccess="paySuccess" @refreshCode="payMoney" @closeCode="closeCode" ref="code" :payAmount="payAmount" :link="link" :paymentType="payId" :orderSn="orderSn"></qr-code>
  146. </div>
  147. </template>
  148. <script>
  149. import bus from "../../common/bus.js";
  150. import qrCode from "../../common/qrCode.vue";
  151. import { mapState } from "vuex";
  152. import { getCouponList } from "../../api/amount.js";
  153. import { sendOrder } from "../../api/order.js";
  154. export default {
  155. data() {
  156. return {
  157. payId: 1,
  158. itemParams: null,
  159. payAmount: 0,
  160. minPrice: 0,
  161. maxPrice: 0,
  162. tipAmount: 0,
  163. couponPrice: 0,
  164. deliveryType: 1, // 1 ->聚合配送, 2-> 自选运力
  165. showCode: false, // 支付二维码弹出层
  166. coupon: "",
  167. order: {},
  168. deliveryList: [],
  169. couponList: [
  170. {
  171. id: -1,
  172. name: "不使用优惠券",
  173. },
  174. ],
  175. couponParams: {},
  176. requestParams: {},
  177. dialogTableVisible: false, // 发起配送弹出层
  178. payList: [
  179. {
  180. id: 1,
  181. name: "支付宝支付",
  182. icon: "../../../static/image/alipay.png",
  183. },
  184. {
  185. id: 2,
  186. name: "微信支付",
  187. icon: "../../../static/image/we-chat.png",
  188. },
  189. {
  190. id: 4,
  191. name: "余额/三方支付",
  192. icon: "../../../static/image/yu-e.png",
  193. },
  194. ],
  195. showCode: false,
  196. link: "",
  197. orderSn: "",
  198. loading: false,
  199. };
  200. },
  201. props: { tabNum: Number },
  202. components: {
  203. qrCode,
  204. },
  205. computed: {
  206. ...mapState(["userInfo"]),
  207. computedAmount() {
  208. console.log("computed里面的coupon", this.couponParams);
  209. let num = this.order.firstCoupon || 0;
  210. let min =
  211. this.order.optionals &&
  212. this.order.optionals.find((item) => {
  213. return item.deliveryAmount == this.minPrice && item.isMine == 0;
  214. });
  215. if (Object.keys(this.couponParams).length < 1) {
  216. if (min) {
  217. return this.minPrice >= this.couponParams.limitFee
  218. ? (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  219. 2
  220. )
  221. : (this.minPrice + this.tipAmount - num).toFixed(2);
  222. } else {
  223. return (this.minPrice + this.tipAmount - num).toFixed(2);
  224. }
  225. } else if (
  226. Object.keys(this.couponParams).length > 0 &&
  227. this.couponParams.type == 1
  228. ) {
  229. if (min) {
  230. return this.minPrice >= this.couponParams.limitFee
  231. ? (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  232. 2
  233. )
  234. : (this.minPrice + this.tipAmount - num).toFixed(2);
  235. } else {
  236. return (this.minPrice + this.tipAmount - num).toFixed(2);
  237. }
  238. } else if (
  239. Object.keys(this.couponParams).length > 0 &&
  240. this.couponParams.type == 3
  241. ) {
  242. if (min) {
  243. return this.minPrice - this.couponPrice + this.tipAmount <= 0
  244. ? 0
  245. : (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  246. 2
  247. );
  248. } else {
  249. return (this.minPrice + this.tipAmount - num).toFixed(2);
  250. }
  251. } else if (
  252. Object.keys(this.couponParams).length > 0 &&
  253. this.couponParams.type == 2
  254. ) {
  255. if (min) {
  256. let newCouponPrice =
  257. this.minPrice * (1 - this.couponParams.discount / 10) <
  258. this.couponParams.maxDiscount
  259. ? this.minPrice *
  260. (1 - (this.couponParams.discount / 10).toFixed(2))
  261. : this.couponParams.maxDiscount;
  262. return this.minPrice - newCouponPrice + this.tipAmount <= 0
  263. ? 0
  264. : (this.minPrice - newCouponPrice + this.tipAmount - num).toFixed(
  265. 2
  266. );
  267. } else {
  268. return (this.minPrice + this.tipAmount - num).toFixed(2);
  269. }
  270. }
  271. },
  272. computedAmountMax() {
  273. let num = this.order.firstCoupon || 0;
  274. let max =
  275. this.order.optionals &&
  276. this.order.optionals.find((item) => {
  277. return item.deliveryAmount == this.maxPrice && item.isMine == 0;
  278. });
  279. if (Object.keys(this.couponParams).length < 1) {
  280. if (max) {
  281. return this.maxPrice >= this.couponParams.limitFee
  282. ? (this.maxPrice - this.couponPrice + this.tipAmount - num).toFixed(
  283. 2
  284. )
  285. : (this.maxPrice + this.tipAmount - num).toFixed(2);
  286. } else {
  287. return (this.maxPrice + this.tipAmount - num).toFixed(2);
  288. }
  289. } else if (
  290. Object.keys(this.couponParams).length > 0 &&
  291. this.couponParams.type == 1
  292. ) {
  293. if (max) {
  294. return this.maxPrice >= this.couponParams.limitFee
  295. ? (this.maxPrice - this.couponPrice + this.tipAmount - num).toFixed(
  296. 2
  297. )
  298. : (this.maxPrice + this.tipAmount - num).toFixed(2);
  299. } else {
  300. return (this.maxPrice + this.tipAmount - num).toFixed(2);
  301. }
  302. } else if (
  303. Object.keys(this.couponParams).length > 0 &&
  304. this.couponParams.type == 3
  305. ) {
  306. if (max) {
  307. return this.maxPrice - this.couponPrice + this.tipAmount <= 0
  308. ? 0
  309. : (this.maxPrice - this.couponPrice + this.tipAmount - num).toFixed(
  310. 2
  311. );
  312. } else {
  313. return (this.maxPrice + this.tipAmount - num).toFixed(2);
  314. }
  315. } else if (
  316. Object.keys(this.couponParams).length > 0 &&
  317. this.couponParams.type == 2
  318. ) {
  319. if (max) {
  320. let newCouponPrice =
  321. this.maxPrice * (1 - this.couponParams.discount / 10) <
  322. this.couponParams.maxDiscount
  323. ? this.maxPrice *
  324. (1 - (this.couponParams.discount / 10).toFixed(2))
  325. : this.couponParams.maxDiscount;
  326. return this.maxPrice - newCouponPrice + this.tipAmount <= 0
  327. ? 0
  328. : (this.maxPrice - newCouponPrice + this.tipAmount - num).toFixed(
  329. 2
  330. );
  331. } else {
  332. return (this.maxPrice + this.tipAmount - num).toFixed(2);
  333. }
  334. }
  335. },
  336. computedAmountOther() {
  337. let num = this.order.firstCoupon || 0;
  338. let min =
  339. this.order.optionals &&
  340. this.order.optionals.find((item) => {
  341. return item.deliveryAmount == this.minPrice && item.isMine == 0;
  342. });
  343. if (Object.keys(this.couponParams).length < 1) {
  344. if (min) {
  345. return this.minPrice >= this.couponParams.limitFee
  346. ? (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  347. 2
  348. )
  349. : (this.minPrice + this.tipAmount - num).toFixed(2);
  350. } else {
  351. return (this.minPrice + this.tipAmount - num).toFixed(2);
  352. }
  353. } else if (
  354. Object.keys(this.couponParams).length > 0 &&
  355. this.couponParams.type == 1
  356. ) {
  357. if (min) {
  358. return this.minPrice >= this.couponParams.limitFee
  359. ? (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  360. 2
  361. )
  362. : (this.minPrice + this.tipAmount - num).toFixed(2);
  363. } else {
  364. return (this.minPrice + this.tipAmount - num).toFixed(2);
  365. }
  366. } else if (
  367. Object.keys(this.couponParams).length > 0 &&
  368. this.couponParams.type == 3
  369. ) {
  370. if (min) {
  371. return this.minPrice - this.couponPrice + this.tipAmount <= 0
  372. ? 0
  373. : (this.minPrice - this.couponPrice + this.tipAmount - num).toFixed(
  374. 2
  375. );
  376. } else {
  377. return (this.minPrice + this.tipAmount - num).toFixed(2);
  378. }
  379. } else if (
  380. Object.keys(this.couponParams).length > 0 &&
  381. this.couponParams.type == 2
  382. ) {
  383. if (min) {
  384. let newCouponPrice =
  385. this.minPrice * (1 - this.couponParams.discount / 10) <
  386. this.couponParams.maxDiscount
  387. ? this.minPrice *
  388. (1 - (this.couponParams.discount / 10).toFixed(2))
  389. : this.couponParams.maxDiscount;
  390. return this.minPrice - newCouponPrice + this.tipAmount <= 0
  391. ? 0
  392. : (this.minPrice - newCouponPrice + this.tipAmount - num).toFixed(
  393. 2
  394. );
  395. } else {
  396. return (this.minPrice + this.tipAmount - num).toFixed(2);
  397. }
  398. }
  399. },
  400. },
  401. methods: {
  402. closeCode() {
  403. this.showCode = false;
  404. this.loading = false;
  405. },
  406. paySuccess() {
  407. this.showCode = false;
  408. this.dialogTableVisible = false;
  409. this.loading = false;
  410. if (this.tabNum === -1) {
  411. bus.$emit("refreshData2");
  412. return;
  413. }
  414. bus.$emit("pullData", 2);
  415. },
  416. payMoney() {
  417. if (this.deliveryType !== 1) {
  418. let arr = this.deliveryList.filter((item) => {
  419. return item.isChoose;
  420. });
  421. if (arr && arr.length < 1) {
  422. return this.$message({
  423. message: "请选择运力",
  424. type: "error",
  425. });
  426. }
  427. }
  428. this.loading = true;
  429. let params = {
  430. ...this.requestParams,
  431. createType: 1,
  432. valuationRes:
  433. this.deliveryType == 1
  434. ? this.deliveryList
  435. : this.deliveryList.filter((v) => {
  436. return v.isChoose;
  437. }),
  438. paymentType: this.payId,
  439. };
  440. if (Object.keys(this.couponParams).length > 0) {
  441. params.couponId = this.couponParams.id;
  442. }
  443. sendOrder(params).then((res) => {
  444. if (res.code == 200) {
  445. if (this.payId == 4) {
  446. this.dialogTableVisible = false;
  447. this.loading = false;
  448. if (this.tabNum === -1) {
  449. bus.$emit("refreshData2");
  450. return;
  451. }
  452. bus.$emit("pullData", 2);
  453. if(this.$route.name === 'manualCreate'){
  454. this.$route.push({
  455. path:'/'
  456. })
  457. }
  458. console.log('path',this.$route);
  459. } else if (
  460. (this.payId == 1 || this.payId == 2) &&
  461. res.data.status == 1
  462. ) {
  463. this.payAmount = res.data.amount || 0;
  464. this.link = res.data.data;
  465. this.orderSn = res.data.orderSn;
  466. this.showCode = true;
  467. } else if (
  468. (this.payId == 1 || this.payId == 2) &&
  469. res.data.status == 0
  470. ) {
  471. this.loading = false;
  472. return this.$message({
  473. message: "获取二维码失败,请联系客服",
  474. type: "error",
  475. });
  476. }
  477. } else if (res.code === 250) {
  478. this.loading = false;
  479. this.$confirm("当前账户余额不足, 是否前去充值?", "提示", {
  480. confirmButtonText: "立即充值",
  481. cancelButtonText: "取消",
  482. type: "warning",
  483. }).then(() => {
  484. this.$router.push({
  485. path: "/shopInfo/shopAccount",
  486. });
  487. });
  488. } else {
  489. this.loading = false;
  490. this.$message({
  491. message: res.msg,
  492. type: "error",
  493. });
  494. }
  495. });
  496. },
  497. // 自选运力点击事件
  498. deliveryItem(item) {
  499. this.deliveryType = 2;
  500. this.$set(item, "isChoose", !item.isChoose);
  501. this.$forceUpdate();
  502. console.log(item.isChoose);
  503. },
  504. selectCouponChange(coupon) {
  505. if (coupon.type == 1 || coupon.type == 3) {
  506. this.couponPrice = coupon.money;
  507. } else if (coupon.type == 2) {
  508. this.couponPrice = coupon.maxDiscount;
  509. }
  510. let self = this;
  511. if (this.order.optionals) {
  512. this.order.optionals.forEach((item) => {
  513. if (coupon.type === 1) {
  514. if (item.deliveryAmount >= coupon.limitFee) {
  515. item.couponPrice = coupon.money;
  516. } else {
  517. item.couponPrice = 0;
  518. }
  519. } else if (coupon.type === 3) {
  520. item.couponPrice = coupon.money;
  521. } else if (coupon.type == 2) {
  522. if (
  523. item.deliveryAmount * (1 - coupon.discount / 10) >
  524. coupon.maxDiscount
  525. ) {
  526. item.couponPrice = coupon.maxDiscount;
  527. } else {
  528. item.couponPrice = (
  529. item.deliveryAmount *
  530. (1 - coupon.discount / 10)
  531. ).toFixed(2);
  532. }
  533. }
  534. });
  535. }
  536. },
  537. discount(cost, tipPrice, couponPrice, firstCoupon, select) {
  538. if (
  539. this.couponParams.type == 1 &&
  540. select == 0 &&
  541. cost >= this.couponParams.limitFee
  542. ) {
  543. let price = couponPrice + firstCoupon;
  544. return price >= 0 ? price.toFixed(2) : 0;
  545. } else if (this.couponParams.type == 3 && select == 0) {
  546. let price = couponPrice + firstCoupon;
  547. return price >= 0 ? price.toFixed(2) : 0;
  548. } else if (this.couponParams.type == 2 && select == 0) {
  549. let newCouponPrice =
  550. cost * (1 - this.couponParams.discount / 10) <
  551. this.couponParams.maxDiscount
  552. ? cost * (1 - this.couponParams.discount / 10)
  553. : this.couponParams.maxDiscount;
  554. let price = newCouponPrice + firstCoupon;
  555. return price >= 0 ? price.toFixed(2) : 0;
  556. } else {
  557. let price = firstCoupon;
  558. console.log("初始加载值", this.couponParams.type);
  559. return price >= 0 ? price.toFixed(2) : 0;
  560. }
  561. },
  562. computePrice(cost, tipPrice, couponPrice, firstCoupon, select) {
  563. if (
  564. this.couponParams.type == 1 &&
  565. select == 0 &&
  566. cost >= this.couponParams.limitFee
  567. ) {
  568. let price = cost + parseFloat(tipPrice) - couponPrice - firstCoupon;
  569. return price >= 0 ? price.toFixed(2) : 0;
  570. } else if (this.couponParams.type == 3 && select == 0) {
  571. let price = cost + parseFloat(tipPrice) - couponPrice - firstCoupon;
  572. return price >= 0 ? price.toFixed(2) : 0;
  573. } else if (this.couponParams.type == 2 && select == 0) {
  574. let newCouponPrice =
  575. cost * (1 - this.couponParams.discount / 10) <
  576. this.couponParams.maxDiscount
  577. ? cost * (1 - this.couponParams.discount / 10)
  578. : this.couponParams.maxDiscount;
  579. let price = cost + parseFloat(tipPrice) - newCouponPrice - firstCoupon;
  580. return price >= 0 ? price.toFixed(2) : 0;
  581. } else {
  582. let price = cost + parseFloat(tipPrice) - firstCoupon;
  583. console.log("初始加载值", this.couponParams.type);
  584. return price >= 0 ? price.toFixed(2) : 0;
  585. }
  586. },
  587. // 选择优惠券
  588. chooseCoupon(e) {
  589. this.couponParams =
  590. this.couponList.find((item) => {
  591. return item.id == e && e != -1;
  592. }) || {};
  593. console.log("couponParams", this.couponParams);
  594. if (this.couponParams.type == 1 || this.couponParams.type == 3) {
  595. this.couponPrice = this.couponParams.money;
  596. } else if (this.couponParams.type == 2) {
  597. this.couponPrice = this.couponParams.maxDiscount;
  598. }
  599. this.selectCouponChange(this.couponParams);
  600. },
  601. changeDeliveryType() {
  602. if (this.deliveryType == 1) return;
  603. this.deliveryType = 1;
  604. this.deliveryList.forEach((v) => {
  605. v.isChoose = false;
  606. });
  607. },
  608. init(order, data) {
  609. console.log(order, "-----------------------------------");
  610. this.requestParams = data;
  611. this.order = order;
  612. this.minPrice = 0;
  613. this.maxPrice = 0;
  614. this.tipAmount = order.tipAmount || 0;
  615. this.deliveryList = order.optionals;
  616. this.deliveryList.forEach((item) => {
  617. if (item.preferredDelivery) {
  618. item.isChoose = true;
  619. this.deliveryType = 2;
  620. } else {
  621. item.isChoose = false;
  622. }
  623. });
  624. if (this.order.optionals) {
  625. this.minPrice = this.order.optionals[0].deliveryAmount;
  626. for (var i = 0; i < this.order.optionals.length; i++) {
  627. var item = this.order.optionals[i];
  628. this.minPrice =
  629. this.minPrice >= item.deliveryAmount
  630. ? item.deliveryAmount
  631. : this.minPrice;
  632. this.maxPrice =
  633. this.maxPrice <= item.deliveryAmount
  634. ? item.deliveryAmount
  635. : this.maxPrice;
  636. }
  637. }
  638. this.payId = 4;
  639. this.dialogTableVisible = true;
  640. this.getCouponList();
  641. },
  642. getCouponList() {
  643. let params = {
  644. status: 0,
  645. isNew: 1,
  646. };
  647. getCouponList(params).then((res) => {
  648. if (res.code == 200) {
  649. let data = res.data.data;
  650. if (!data.length) return;
  651. this.couponList = [
  652. {
  653. id: -1,
  654. name: "不使用优惠券",
  655. },
  656. ].concat(data);
  657. // 默认选中一个优惠券
  658. this.coupon = data[0].id;
  659. this.chooseCoupon(data[0].id);
  660. }
  661. });
  662. },
  663. },
  664. };
  665. </script>
  666. <style lang="scss" scoped>
  667. /deep/ .el-dialog__header {
  668. padding: 0;
  669. }
  670. /deep/ .el-dialog__body {
  671. padding: 0px !important;
  672. }
  673. .pay-modal {
  674. overflow: hidden;
  675. .pay-top {
  676. height: 80px;
  677. line-height: 80px;
  678. text-align: center;
  679. font-size: 22px;
  680. font-family: PingFang SC;
  681. font-weight: bold;
  682. color: #ffffff;
  683. background: url(../../../static/image/pay-bg.png) no-repeat;
  684. background-size: 100% 100%;
  685. }
  686. }
  687. .code-content {
  688. width: 640px;
  689. margin: 40px auto 0;
  690. padding-bottom: 100px;
  691. box-sizing: border-box;
  692. .code-top {
  693. display: flex;
  694. justify-content: space-between;
  695. align-items: center;
  696. padding: 14px 20px;
  697. .code-left {
  698. .l-title {
  699. font-size: 14px;
  700. font-family: PingFang SC;
  701. font-weight: bold;
  702. color: #0d1e40;
  703. }
  704. .l-price {
  705. font-size: 14px;
  706. font-family: PingFang SC;
  707. font-weight: 400;
  708. color: #9ea7b7;
  709. }
  710. }
  711. .code-right {
  712. font-size: 24px;
  713. font-family: PingFang SC;
  714. font-weight: 600;
  715. color: #f74141;
  716. }
  717. }
  718. .code-bottom {
  719. text-align: center;
  720. padding-top: 30px;
  721. .code-img {
  722. width: 260px;
  723. height: 260px;
  724. margin: 0 auto;
  725. }
  726. .des {
  727. font-size: 14px;
  728. font-family: PingFang SC;
  729. font-weight: 400;
  730. color: #0d1e40;
  731. margin: 10px 0 20px 0;
  732. }
  733. .guo-qi {
  734. font-size: 14px;
  735. font-family: PingFang SC;
  736. font-weight: 400;
  737. color: #9ea7b7;
  738. span {
  739. color: #175199;
  740. cursor: pointer;
  741. }
  742. }
  743. }
  744. }
  745. .send-content {
  746. border-radius: 10px;
  747. padding: 22px;
  748. }
  749. .top-juhe {
  750. display: flex;
  751. justify-content: space-between;
  752. padding: 20px;
  753. position: relative;
  754. border: 1px solid #999;
  755. border-radius: 8px;
  756. overflow: hidden;
  757. &.active {
  758. border-color: #fc7200;
  759. }
  760. .left-content {
  761. display: flex;
  762. .juhe-icon {
  763. align-self: center;
  764. font-size: 0;
  765. width: 41px;
  766. height: 40px;
  767. margin-right: 12px;
  768. img {
  769. width: 100%;
  770. height: 100%;
  771. }
  772. }
  773. .juhe-title {
  774. font-size: 16px;
  775. font-family: PingFang SC;
  776. font-weight: bold;
  777. color: #0d1e40;
  778. }
  779. .quan-wang {
  780. margin-top: 8px;
  781. span {
  782. display: inline-block;
  783. padding: 0px 4px;
  784. border: 1px solid #fc7200;
  785. border-radius: 2px;
  786. color: #fc7200;
  787. font-size: 14px;
  788. }
  789. }
  790. }
  791. .right-content {
  792. .right-title {
  793. font-size: 14px;
  794. font-family: PingFang SC;
  795. font-weight: bold;
  796. color: #0d1e40;
  797. span {
  798. font-size: 22px;
  799. color: #fc7200;
  800. }
  801. }
  802. .youhui {
  803. text-align: right;
  804. font-size: 12px;
  805. font-family: PingFang SC;
  806. font-weight: 400;
  807. color: #fc7200;
  808. }
  809. }
  810. .choose-icon {
  811. width: 32px;
  812. height: 32px;
  813. position: absolute;
  814. right: 0;
  815. bottom: 0;
  816. }
  817. }
  818. .choose-self {
  819. padding-top: 25px;
  820. border-bottom: 1px solid #eee;
  821. .self-top {
  822. display: flex;
  823. align-items: center;
  824. margin-bottom: 11px;
  825. .choose-self-icon {
  826. width: 4px;
  827. height: 15px;
  828. margin-right: 10px;
  829. }
  830. span {
  831. font-size: 14px;
  832. font-family: PingFang SC;
  833. font-weight: 400;
  834. color: #92959b;
  835. }
  836. }
  837. .delivery-list {
  838. max-height: 340px;
  839. overflow-y: auto;
  840. &-item {
  841. /*height: 76px;*/
  842. padding: 18px;
  843. box-sizing: border-box;
  844. display: flex;
  845. justify-content: space-between;
  846. align-items: center;
  847. .item-left {
  848. display: flex;
  849. .item-logo {
  850. font-size: 0;
  851. width: 40px;
  852. height: 40px;
  853. margin-right: 15px;
  854. img {
  855. width: 100%;
  856. height: 100%;
  857. }
  858. }
  859. .item-title {
  860. font-size: 16px;
  861. font-family: PingFang SC;
  862. font-weight: bold;
  863. color: #0d1e40;
  864. }
  865. .item-miters {
  866. margin-top: 4px;
  867. font-size: 12px;
  868. font-family: PingFang SC;
  869. font-weight: 400;
  870. color: #9ea7b7;
  871. }
  872. }
  873. .item-right {
  874. display: flex;
  875. align-items: center;
  876. .item-price {
  877. font-size: 14px;
  878. font-family: PingFang SC;
  879. font-weight: bold;
  880. color: #0d1e40;
  881. span {
  882. font-size: 22px;
  883. }
  884. }
  885. .item-coupon {
  886. text-align: right;
  887. font-size: 12px;
  888. font-family: PingFang SC;
  889. font-weight: 400;
  890. color: #fc7200;
  891. }
  892. .item-choose {
  893. margin-left: 26px;
  894. font-size: 0;
  895. width: 26px;
  896. height: 26px;
  897. img {
  898. width: 100%;
  899. height: 100%;
  900. }
  901. }
  902. }
  903. }
  904. }
  905. .delivery-list::-webkit-scrollbar {
  906. width: 6px;
  907. }
  908. .delivery-list::-webkit-scrollbar-track {
  909. background-color: #eee;
  910. /*border-radius: 5px;
  911. -webkit-border-radius: 5px;
  912. -moz-border-radius: 5px;*/
  913. }
  914. .delivery-list::-webkit-scrollbar-thumb {
  915. background-color: #999;
  916. border-radius: 6px;
  917. -webkit-border-radius: 6px;
  918. -moz-border-radius: 6px;
  919. }
  920. .pay-list {
  921. display: flex;
  922. align-items: center;
  923. padding-top: 10px;
  924. .pay-item {
  925. flex: 1;
  926. display: flex;
  927. justify-content: center;
  928. text-align: center;
  929. align-items: center;
  930. height: 67px;
  931. border: 1px solid #eee;
  932. border-radius: 8px;
  933. cursor: pointer;
  934. &.pay-active {
  935. border-color: #fc7200;
  936. }
  937. &:nth-child(2) {
  938. margin: 0 13px;
  939. }
  940. span {
  941. font-size: 14px;
  942. font-family: PingFang SC;
  943. font-weight: bold;
  944. color: #222222;
  945. }
  946. .pay-icon {
  947. margin-right: 6px;
  948. }
  949. .pay-icon:nth-child(1) {
  950. width: 25px;
  951. height: 24px;
  952. }
  953. }
  954. }
  955. }
  956. .btn-wrap {
  957. display: flex;
  958. justify-content: flex-end;
  959. .submit-btn {
  960. border: none;
  961. background: #fc7200;
  962. color: #ffffff;
  963. margin-top: 20px;
  964. }
  965. }
  966. .choose-coupon {
  967. display: flex;
  968. justify-content: space-between;
  969. align-items: center;
  970. margin-top: 16px;
  971. .coupon-box {
  972. display: flex;
  973. align-items: center;
  974. .coupon-icon {
  975. width: 14px;
  976. height: 14px;
  977. }
  978. span {
  979. font-size: 14px;
  980. font-family: PingFang SC;
  981. font-weight: 400;
  982. color: #b1b1b1;
  983. margin-left: 2px;
  984. margin-right: 6px;
  985. cursor: pointer;
  986. }
  987. .arrow-down {
  988. width: 10px;
  989. height: 6px;
  990. }
  991. }
  992. }
  993. </style>