confirmCreateOrder.vue 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 收货人 -->
  5. <view class="address-box" v-if="address==null" @click="openAddress()">
  6. <view class="left">
  7. <view class="name-box">
  8. <text class="text name">添加收货地址</text>
  9. </view>
  10. </view>
  11. <view class="arrow-box">
  12. <image src="/static/images/arrow_gray.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="address-box" v-if="address!=null" @click="openAddress()">
  16. <view class="left">
  17. <view class="name-box">
  18. <text class="text name">{{address.realName}}</text>
  19. <text class="text" v-if="address.phone!=null">{{address.phone}}</text>
  20. </view>
  21. <view class="address">
  22. {{address.province}}{{address.city}}{{address.district}}{{address.detail}}
  23. </view>
  24. </view>
  25. <view class="arrow-box">
  26. <image src="/static/images/arrow_gray.png" mode=""></image>
  27. </view>
  28. </view>
  29. <!-- 积分 -->
  30. <view class="price-info">
  31. <view class="price-info-title">价格明细</view>
  32. <view class="points">
  33. <view class="left">
  34. <text class="text">商品总价</text>
  35. </view>
  36. <view class="right" style="align-items: baseline;">
  37. <text class="price-info-unit">¥</text>
  38. <text class="price-info-num">{{(orderData.totalPrice||0).toFixed(2)}}</text>
  39. </view>
  40. </view>
  41. <view class="points" @click="couponVisible = true;">
  42. <view class="left">
  43. <text class="text">优惠券</text>
  44. </view>
  45. <view class="right">
  46. <text class="text">{{couponText}}</text>
  47. <image src="/static/images/arrow4.png" mode=""></image>
  48. </view>
  49. </view>
  50. <view class="points">
  51. <view class="left">
  52. <text class="text">运费</text>
  53. </view>
  54. <view class="right">
  55. <text class="text"
  56. v-if="address!=null">{{orderData.payDelivery==null||orderData.payDelivery==0?'免运费':orderData.payDelivery.toFixed(2)}}</text>
  57. <text class="text" v-if="address==null">--</text>
  58. </view>
  59. </view>
  60. <view class="points">
  61. <view class="left">
  62. <text class="text">合计</text>
  63. </view>
  64. <view class="right" style="align-items: baseline;">
  65. <text class="price-info-unit">¥</text>
  66. <text class="price-info-num">{{(orderData.payPrice||0).toFixed(2)}}</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="btn-foot">
  72. <view class="right">
  73. <view class="total">
  74. <text class="label">合计:</text>
  75. <view class="price">
  76. <text class="unit">¥</text>
  77. <text class="num">{{(orderData.payPrice||0).toFixed(2)}}</text>
  78. </view>
  79. </view>
  80. <view class="btn" @click="submitOrder">提交订单</view>
  81. </view>
  82. </view>
  83. <popupBottom ref="popup" :visible.sync="couponVisible" title=" " bgColor="#f5f5f5" radius="30" maxHeight="60%">
  84. <view class="coupon" style="height:650rpx;">
  85. <div class="coupon-list" v-if="couponsList.length > 0">
  86. <div class="item acea-row row-center-wrapper" v-for="(item, index) in couponsList" :key="index">
  87. <div class="money">
  88. <image v-if="item.status==0&&item.useMinPrice<=orderData.totalPrice" class="img"
  89. src="../../static/images/coupon1.png" mode="widthFix"></image>
  90. <image v-if="item.status!=0||item.useMinPrice>orderData.totalPrice" class="img"
  91. src="../../static/images/coupon2.png" mode="widthFix"></image>
  92. <div style="z-index: 999;">
  93. ¥<span class="num">{{ item.couponPrice }}</span>
  94. </div>
  95. <div class="pic-num">满{{ item.useMinPrice }}元可用</div>
  96. </div>
  97. <div class="text">
  98. <div class="condition line1">
  99. {{ item.couponTitle }}
  100. </div>
  101. <div class="data acea-row row-between-wrapper">
  102. <div>{{ item.limitTime }}到期</div>
  103. <div v-if=" item.status==0&&item.useMinPrice<=orderData.totalPrice"
  104. class="bnt bg-color-red" @click="couponSelect(item)">选择</div>
  105. <div v-else-if="item.status!=0" class="bnt " style="background-color: #878787;">已失效
  106. </div>
  107. <div v-else-if="item.useMinPrice>orderData.totalPrice" class="bnt "
  108. style="background-color: #878787;">未达门槛</div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <view v-if="couponsList.length == 0" class="no-data-box">
  114. <image src="/static/images/no_data.png" mode="aspectFit"></image>
  115. <view class="empty-title">暂无数据</view>
  116. </view>
  117. </view>
  118. </popupBottom>
  119. </view>
  120. </template>
  121. <script>
  122. import {
  123. createliveOrder, // 创建订单
  124. createReward, // 创建中奖订单
  125. userAddr, // 获取用户收货地址
  126. computed,
  127. computedReward,
  128. liveOrderKey, // 生成订单key
  129. } from "@/api/order.js"
  130. import {
  131. curCoupon
  132. } from "@/api/living.js"
  133. import popupBottom from '@/components/px-popup-bottom/px-popup-bottom.vue'
  134. export default {
  135. components: {
  136. popupBottom
  137. },
  138. data() {
  139. return {
  140. orderData: {},
  141. cityId: null,
  142. address: null,
  143. addressId: null,
  144. totalNum: null,
  145. orderKey: null,
  146. goodsId: null,
  147. liveId: null,
  148. orderList: [],
  149. temps: [],
  150. couponUserId: null,
  151. couponText: "请选择",
  152. couponsList: [],
  153. couponVisible: false,
  154. carts: [],
  155. checked: false,
  156. cartIds: null,
  157. confirmParam: [],
  158. type: '',
  159. isFirstLoad: true,
  160. }
  161. },
  162. onLoad(options) {
  163. console.log("确认订单", options)
  164. this.orderKey = options.orderKey;
  165. this.liveId = options.liveId
  166. this.goodsId = options.goodsId
  167. this.productId = options.productId
  168. this.totalNum = Number(options.totalNum) || 0
  169. this.type = options.type
  170. this.isFirstLoad = true;
  171. <<<<<<< HEAD
  172. =======
  173. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  174. if (options.type == 'win') {
  175. this.getKey()
  176. }
  177. },
  178. onShow() {
  179. this.openCoupon()
  180. this.getUserAddr()
  181. uni.$on('updateAddress', (e) => {
  182. this.address = e;
  183. this.addressId = e.addressId;
  184. this.cityId = e.cityId;
  185. });
  186. },
  187. mounted() {
  188. // uni.$on('updateAddress', (e) => {
  189. // this.address = e;
  190. // this.addressId = e.addressId;
  191. // });
  192. },
  193. onUnload() {
  194. uni.$off('updateAddress', this.handleAddressUpdate);
  195. },
  196. beforeDestroy() {
  197. uni.$off('updateAddress');
  198. },
  199. methods: {
  200. handleAddressUpdate(item) {
  201. console.log('接收到地址数据:', item);
  202. this.cityId = item.cityId;
  203. this.address = item;
  204. this.addressId = item.addressId;
  205. if (this.type == 'win') {
  206. this.computedRewardOrder()
  207. } else {
  208. this.computedOrder()
  209. }
  210. },
  211. // 获取用户收货地址
  212. getUserAddr() {
  213. userAddr().then(res => {
  214. if (res.code == 200) {
  215. //console.log("用户收货地址>>>>", res.data)
  216. if (res.data && !this.address) {
  217. this.address = res.data;
  218. }
  219. if (res.data && res.data.cityId) {
  220. this.cityId = res.data.cityId;
  221. }
  222. if (this.type == 'win') {
  223. this.computedRewardOrder()
  224. } else {
  225. this.computedOrder()
  226. }
  227. } else {
  228. uni.showToast({
  229. title: res.msg,
  230. icon: 'none'
  231. });
  232. }
  233. },
  234. rej => {}
  235. );
  236. },
  237. // 获得key
  238. getKey() {
  239. liveOrderKey().then(res => {
  240. if (res.code == 200) {
  241. this.orderKey = res.orderKey
  242. } else {
  243. uni.showToast({
  244. title: res.msg,
  245. icon: 'none'
  246. });
  247. }
  248. },
  249. rej => {}
  250. );
  251. },
  252. // 查询创建订单信息
  253. computedOrder() {
  254. let data = {
  255. cityId: this.cityId || '',
  256. totalNum: this.totalNum,
  257. productId: this.productId,
  258. orderKey: this.orderKey,
  259. couponUserId: this.couponUserId || ''
  260. }
  261. computed(data).then(res => {
  262. if (res.code == 200) {
  263. console.log("查询创建订单信息>>>>", res.data)
  264. this.orderData = res.data
  265. } else {
  266. uni.showToast({
  267. title: res.msg,
  268. icon: 'none'
  269. });
  270. }
  271. },
  272. rej => {}
  273. );
  274. },
  275. // 查询中奖创建订单信息
  276. computedRewardOrder() {
  277. let data = {
  278. cityId: this.cityId || '',
  279. productId: this.productId ,
  280. orderKey: this.orderKey,
  281. totalNum: 1,
  282. }
  283. computedReward(data).then(res => {
  284. if (res.code == 200) {
  285. console.log("查询创建订单信息>>>>", res.data)
  286. <<<<<<< HEAD
  287. this.orderData = res.data || {}
  288. =======
  289. this.orderData = res.data||{}
  290. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  291. } else {
  292. uni.showToast({
  293. title: res.msg,
  294. icon: 'none'
  295. });
  296. }
  297. },
  298. rej => {}
  299. );
  300. },
  301. // 创建订单
  302. createLiveOrder() {
  303. let data = {
  304. cityId: this.cityId,
  305. liveId: this.liveId,
  306. orderKey: this.orderKey,
  307. userName: this.address.realName,
  308. userPhone: this.address.phone,
  309. userAddress: this.address.province + ' ' + this.address.city + ' ' + this.address.district + ' ' +
  310. this.address
  311. .detail,
  312. cartId: "5",
  313. productId: this.productId,
  314. totalNum: this.totalNum,
  315. couponUserId: this.couponUserId
  316. }
  317. <<<<<<< HEAD
  318. return createliveOrder(data).then(res => {
  319. if (res.code == 200) {
  320. this.orderList = res.order;
  321. return res.order;
  322. =======
  323. return createliveOrder(data).then(res => {
  324. if (res.code == 200) {
  325. this.orderList = res.order;
  326. return res.order;
  327. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  328. } else {
  329. uni.showToast({
  330. title: res.msg,
  331. icon: 'none'
  332. });
  333. <<<<<<< HEAD
  334. throw new Error(res.msg);
  335. =======
  336. throw new Error(res.msg);
  337. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  338. }
  339. });
  340. },
  341. // 创建抽奖订单
  342. createRewardOrder() {
  343. <<<<<<< HEAD
  344. let data = {
  345. cityId: this.cityId,
  346. liveId: this.liveId,
  347. orderKey: this.orderKey,
  348. userName: this.address.realName,
  349. userPhone: this.address.phone,
  350. userAddress: this.address.province + ' ' + this.address.city + ' ' + this.address.district + ' ' +
  351. this.address.detail,
  352. cartId: "5",
  353. productId: this.productId,
  354. totalNum: 1,
  355. couponUserId: this.couponUserId
  356. }
  357. return createReward(data).then(res => {
  358. if (res.code == 200) {
  359. this.orderList = res.order || {};
  360. return res.order || {};
  361. } else {
  362. uni.showToast({
  363. title: res.msg,
  364. icon: 'none'
  365. });
  366. throw new Error(res.msg);
  367. }
  368. });
  369. =======
  370. let data = {
  371. cityId: this.cityId,
  372. liveId: this.liveId,
  373. orderKey: this.orderKey,
  374. userName: this.address.realName,
  375. userPhone: this.address.phone,
  376. userAddress: this.address.province + ' ' + this.address.city + ' ' + this.address.district + ' ' + this.address.detail,
  377. cartId: "5",
  378. productId: this.productId,
  379. totalNum: this.totalNum,
  380. couponUserId: this.couponUserId
  381. }
  382. return createReward(data).then(res => {
  383. if (res.code == 200) {
  384. this.orderList = res.order || {};
  385. return res.order || {};
  386. } else {
  387. uni.showToast({
  388. title: res.msg,
  389. icon: 'none'
  390. });
  391. throw new Error(res.msg);
  392. }
  393. });
  394. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  395. },
  396. couponSelect(item) {
  397. this.couponText = "-¥" + (item.couponPrice || 0).toFixed(2);
  398. this.couponUserId = item.id;
  399. this.couponVisible = false;
  400. if (this.type == 'win') {
  401. this.computedRewardOrder()
  402. } else {
  403. this.computedOrder()
  404. }
  405. },
  406. // 自动选择最大优惠券
  407. autoSelectMaxCoupon() {
  408. if (this.couponsList.length === 0 || !this.isFirstLoad) {
  409. return;
  410. }
  411. <<<<<<< HEAD
  412. const availableCoupons = this.couponsList.filter(item =>
  413. =======
  414. const availableCoupons = this.couponsList.filter(item =>
  415. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  416. item.status === 0 && item.useMinPrice <= (this.orderData.totalPrice || 0)
  417. );
  418. if (availableCoupons.length === 0) {
  419. return;
  420. }
  421. availableCoupons.sort((a, b) => b.couponPrice - a.couponPrice);
  422. const maxCoupon = availableCoupons[0];
  423. this.couponText = "-¥" + (maxCoupon.couponPrice || 0).toFixed(2);
  424. this.couponUserId = maxCoupon.id;
  425. <<<<<<< HEAD
  426. =======
  427. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  428. console.log('自动选择最大优惠券:', maxCoupon);
  429. this.isFirstLoad = false;
  430. // 重新计算订单价格
  431. if (this.type == 'win') {
  432. this.computedRewardOrder()
  433. } else {
  434. this.computedOrder()
  435. }
  436. },
  437. openCoupon() {
  438. console.log("点了优惠券列表")
  439. if (!this.liveId || !this.goodsId) {
  440. console.log('缺少必要参数,跳过优惠券请求');
  441. return;
  442. }
  443. const data = {
  444. liveId: this.liveId,
  445. goodsId: this.goodsId
  446. };
  447. curCoupon(data).then(res => {
  448. this.couponsList = res.data || [];
  449. if (this.isFirstLoad) {
  450. setTimeout(() => {
  451. this.autoSelectMaxCoupon();
  452. }, 100);
  453. }
  454. })
  455. },
  456. openAddress() {
  457. uni.navigateTo({
  458. url: '/pages_user/user/address'
  459. })
  460. },
  461. // 提交订单
  462. async submitOrder() {
  463. <<<<<<< HEAD
  464. try {
  465. if (this.orderKey == null) {
  466. uni.showToast({
  467. icon: 'none',
  468. title: '订单KEY不存在',
  469. });
  470. return;
  471. }
  472. if (this.address == null) {
  473. uni.showToast({
  474. icon: 'none',
  475. title: '收货地址不能为空',
  476. });
  477. return;
  478. }
  479. let orderList;
  480. if (this.type == "win") {
  481. orderList = await this.createRewardOrder(); // 中奖订单
  482. } else {
  483. orderList = await this.createLiveOrder(); // 购买订单
  484. }
  485. console.log("orderList>>", orderList)
  486. const orderListStr = encodeURIComponent(JSON.stringify(orderList));
  487. uni.navigateTo({
  488. url: `/pages_shopping/live/paymentOrder?orderList=${orderListStr}&couponUserId=${this.couponUserId}&type=${this.type}`
  489. });
  490. } catch (error) {
  491. console.error('提交订单错误:', error);
  492. uni.showToast({
  493. title: error.message || '提交订单失败',
  494. icon: 'none'
  495. });
  496. }
  497. },
  498. }
  499. }
  500. </script>
  501. <style lang="scss">
  502. .inner-box {
  503. padding: 20rpx 20rpx 140rpx;
  504. .address-box {
  505. margin-bottom: 20rpx;
  506. box-sizing: border-box;
  507. min-height: 171rpx;
  508. background: #FFFFFF;
  509. border-radius: 16rpx;
  510. background-repeat: no-repeat;
  511. background-size: 100% 30rpx;
  512. background-position: left bottom;
  513. padding: 38rpx 30rpx 36rpx;
  514. display: flex;
  515. align-items: center;
  516. justify-content: space-between;
  517. .left {
  518. width: 92%;
  519. .name-box {
  520. display: flex;
  521. align-items: center;
  522. .text {
  523. font-size: 32rpx;
  524. font-family: PingFang SC;
  525. font-weight: bold;
  526. color: #111111;
  527. line-height: 1;
  528. &.name {
  529. margin-right: 30rpx;
  530. }
  531. }
  532. }
  533. .address {
  534. font-size: 28rpx;
  535. font-family: PingFang SC;
  536. font-weight: 500;
  537. color: #666666;
  538. line-height: 42rpx;
  539. text-align: left;
  540. margin-top: 23rpx;
  541. }
  542. }
  543. .arrow-box {
  544. width: 12rpx;
  545. height: 23rpx;
  546. display: flex;
  547. align-items: cenetr;
  548. justify-content: cenetr;
  549. image {
  550. width: 100%;
  551. height: 100%;
  552. }
  553. }
  554. }
  555. .price-info {
  556. background: #FFFFFF;
  557. border-radius: 16rpx;
  558. &-title {
  559. padding: 30rpx 30rpx 20rpx 30rpx;
  560. font-family: PingFang SC, PingFang SC;
  561. font-weight: 500;
  562. font-size: 30rpx;
  563. color: #111;
  564. }
  565. &-unit {
  566. font-size: 24rpx;
  567. }
  568. &-num {
  569. font-size: 28rpx;
  570. }
  571. }
  572. .points {
  573. height: 88rpx;
  574. padding: 0 30rpx;
  575. background: #FFFFFF;
  576. border-radius: 16rpx;
  577. display: flex;
  578. align-items: center;
  579. justify-content: space-between;
  580. .left {
  581. display: flex;
  582. align-items: center;
  583. image {
  584. width: 28rpx;
  585. height: 28rpx;
  586. margin-right: 20rpx;
  587. }
  588. .text {
  589. font-size: 28rpx;
  590. font-family: PingFang SC;
  591. font-weight: 500;
  592. color: #666666;
  593. }
  594. }
  595. .right {
  596. display: flex;
  597. align-items: center;
  598. .text {
  599. font-size: 28rpx;
  600. font-family: PingFang SC;
  601. font-weight: 500;
  602. color: #111111;
  603. }
  604. image {
  605. margin-left: 15rpx;
  606. width: 14rpx;
  607. height: 24rpx;
  608. }
  609. }
  610. }
  611. }
  612. .btn-foot {
  613. box-sizing: border-box;
  614. width: 100%;
  615. height: 121rpx;
  616. background: #FFFFFF;
  617. padding: 16rpx 30rpx 16rpx 60rpx;
  618. display: flex;
  619. align-items: center;
  620. justify-content: flex-end;
  621. position: fixed;
  622. left: 0;
  623. bottom: 0;
  624. z-index: 99;
  625. .right {
  626. display: flex;
  627. align-items: center;
  628. .total {
  629. display: flex;
  630. align-items: flex-end;
  631. margin-right: 36rpx;
  632. .label {
  633. font-size: 26rpx;
  634. font-family: PingFang SC;
  635. font-weight: 500;
  636. color: #999999;
  637. line-height: 1.5;
  638. }
  639. .price {
  640. display: flex;
  641. align-items: flex-end;
  642. .unit {
  643. font-size: 32rpx;
  644. font-family: PingFang SC;
  645. font-weight: bold;
  646. color: #FF6633;
  647. line-height: 1.2;
  648. margin-right: 10rpx;
  649. }
  650. .num {
  651. font-size: 50rpx;
  652. font-family: PingFang SC;
  653. font-weight: bold;
  654. color: #FF6633;
  655. line-height: 1;
  656. }
  657. }
  658. }
  659. .btn {
  660. width: 200rpx;
  661. height: 88rpx;
  662. line-height: 88rpx;
  663. text-align: center;
  664. font-size: 30rpx;
  665. font-family: PingFang SC;
  666. font-weight: bold;
  667. color: #FFFFFF;
  668. background: #2BC7B9;
  669. border-radius: 44rpx;
  670. }
  671. }
  672. }
  673. .coupon {
  674. height: 100%;
  675. }
  676. /*优惠券列表公共*/
  677. .coupon-list {}
  678. .coupon-list .item {
  679. display: flex;
  680. flex-direction: column;
  681. justify-content: center;
  682. align-items: center;
  683. width: 100%;
  684. height: 1.7 * 100rpx;
  685. margin-bottom: 0.16 * 100rpx;
  686. }
  687. .coupon-list .item .money {
  688. background-size: 100% 100%;
  689. width: 2.4 * 100rpx;
  690. height: 100%;
  691. color: #fff;
  692. font-size: 0.36 * 100rpx;
  693. font-weight: bold;
  694. text-align: center;
  695. display: flex;
  696. flex-direction: column;
  697. align-items: center;
  698. justify-content: center;
  699. position: relative;
  700. }
  701. .coupon-list .item .money .img {
  702. position: absolute;
  703. width: 2.4 * 100rpx;
  704. height: 100%;
  705. color: #fff;
  706. }
  707. .coupon-list .item .money .num {
  708. font-size: 0.6 * 100rpx;
  709. }
  710. .coupon-list .item .money .pic-num {
  711. font-size: 20rpx;
  712. z-index: 99;
  713. }
  714. .coupon-list .item .text {
  715. width: 4.5 * 100rpx;
  716. padding: 0 0.17 * 100rpx 0 0.24 * 100rpx;
  717. background-color: #fff;
  718. box-sizing: border-box;
  719. }
  720. .coupon-list .item .text .condition {
  721. font-size: 0.3 * 100rpx;
  722. color: #282828;
  723. height: 0.93 * 100rpx;
  724. line-height: 0.93 * 100rpx;
  725. border-bottom: 1px solid #f0f0f0;
  726. }
  727. .coupon-list .item .text .data {
  728. font-size: 0.2 * 100rpx;
  729. color: #999;
  730. height: 0.76 * 100rpx;
  731. }
  732. .coupon-list .item .text .data .bnt {
  733. width: 1.36 * 100rpx;
  734. height: 0.44 * 100rpx;
  735. border-radius: 0.22 * 100rpx;
  736. font-size: 0.22 * 100rpx;
  737. color: #fff;
  738. text-align: center;
  739. line-height: 0.44 * 100rpx;
  740. background-color: red;
  741. }
  742. =======
  743. try {
  744. if (this.orderKey == null) {
  745. uni.showToast({
  746. icon: 'none',
  747. title: '订单KEY不存在',
  748. });
  749. return;
  750. }
  751. if (this.address == null) {
  752. uni.showToast({
  753. icon: 'none',
  754. title: '收货地址不能为空',
  755. });
  756. return;
  757. }
  758. let orderList;
  759. if (this.type == "win") {
  760. orderList = await this.createRewardOrder(); // 中奖订单
  761. } else {
  762. orderList = await this.createLiveOrder(); // 购买订单
  763. }
  764. console.log("orderList>>", orderList)
  765. const orderListStr = encodeURIComponent(JSON.stringify(orderList));
  766. uni.navigateTo({
  767. url: `/pages_shopping/live/paymentOrder?orderList=${orderListStr}&couponUserId=${this.couponUserId}&type=${this.type}`
  768. });
  769. } catch (error) {
  770. console.error('提交订单错误:', error);
  771. uni.showToast({
  772. title: error.message || '提交订单失败',
  773. icon: 'none'
  774. });
  775. }
  776. },
  777. }
  778. }
  779. </script>
  780. <style lang="scss">
  781. .inner-box {
  782. padding: 20rpx 20rpx 140rpx;
  783. .address-box {
  784. margin-bottom: 20rpx;
  785. box-sizing: border-box;
  786. min-height: 171rpx;
  787. background: #FFFFFF;
  788. border-radius: 16rpx;
  789. background-repeat: no-repeat;
  790. background-size: 100% 30rpx;
  791. background-position: left bottom;
  792. padding: 38rpx 30rpx 36rpx;
  793. display: flex;
  794. align-items: center;
  795. justify-content: space-between;
  796. .left {
  797. width: 92%;
  798. .name-box {
  799. display: flex;
  800. align-items: center;
  801. .text {
  802. font-size: 32rpx;
  803. font-family: PingFang SC;
  804. font-weight: bold;
  805. color: #111111;
  806. line-height: 1;
  807. &.name {
  808. margin-right: 30rpx;
  809. }
  810. }
  811. }
  812. .address {
  813. font-size: 28rpx;
  814. font-family: PingFang SC;
  815. font-weight: 500;
  816. color: #666666;
  817. line-height: 42rpx;
  818. text-align: left;
  819. margin-top: 23rpx;
  820. }
  821. }
  822. .arrow-box {
  823. width: 12rpx;
  824. height: 23rpx;
  825. display: flex;
  826. align-items: cenetr;
  827. justify-content: cenetr;
  828. image {
  829. width: 100%;
  830. height: 100%;
  831. }
  832. }
  833. }
  834. .price-info {
  835. background: #FFFFFF;
  836. border-radius: 16rpx;
  837. &-title {
  838. padding: 30rpx 30rpx 20rpx 30rpx;
  839. font-family: PingFang SC, PingFang SC;
  840. font-weight: 500;
  841. font-size: 30rpx;
  842. color: #111;
  843. }
  844. &-unit {
  845. font-size: 24rpx;
  846. }
  847. &-num {
  848. font-size: 28rpx;
  849. }
  850. }
  851. .points {
  852. height: 88rpx;
  853. padding: 0 30rpx;
  854. background: #FFFFFF;
  855. border-radius: 16rpx;
  856. display: flex;
  857. align-items: center;
  858. justify-content: space-between;
  859. .left {
  860. display: flex;
  861. align-items: center;
  862. image {
  863. width: 28rpx;
  864. height: 28rpx;
  865. margin-right: 20rpx;
  866. }
  867. .text {
  868. font-size: 28rpx;
  869. font-family: PingFang SC;
  870. font-weight: 500;
  871. color: #666666;
  872. }
  873. }
  874. .right {
  875. display: flex;
  876. align-items: center;
  877. .text {
  878. font-size: 28rpx;
  879. font-family: PingFang SC;
  880. font-weight: 500;
  881. color: #111111;
  882. }
  883. image {
  884. margin-left: 15rpx;
  885. width: 14rpx;
  886. height: 24rpx;
  887. }
  888. }
  889. }
  890. }
  891. .btn-foot {
  892. box-sizing: border-box;
  893. width: 100%;
  894. height: 121rpx;
  895. background: #FFFFFF;
  896. padding: 16rpx 30rpx 16rpx 60rpx;
  897. display: flex;
  898. align-items: center;
  899. justify-content: flex-end;
  900. position: fixed;
  901. left: 0;
  902. bottom: 0;
  903. z-index: 99;
  904. .right {
  905. display: flex;
  906. align-items: center;
  907. .total {
  908. display: flex;
  909. align-items: flex-end;
  910. margin-right: 36rpx;
  911. .label {
  912. font-size: 26rpx;
  913. font-family: PingFang SC;
  914. font-weight: 500;
  915. color: #999999;
  916. line-height: 1.5;
  917. }
  918. .price {
  919. display: flex;
  920. align-items: flex-end;
  921. .unit {
  922. font-size: 32rpx;
  923. font-family: PingFang SC;
  924. font-weight: bold;
  925. color: #FF6633;
  926. line-height: 1.2;
  927. margin-right: 10rpx;
  928. }
  929. .num {
  930. font-size: 50rpx;
  931. font-family: PingFang SC;
  932. font-weight: bold;
  933. color: #FF6633;
  934. line-height: 1;
  935. }
  936. }
  937. }
  938. .btn {
  939. width: 200rpx;
  940. height: 88rpx;
  941. line-height: 88rpx;
  942. text-align: center;
  943. font-size: 30rpx;
  944. font-family: PingFang SC;
  945. font-weight: bold;
  946. color: #FFFFFF;
  947. background: #2BC7B9;
  948. border-radius: 44rpx;
  949. }
  950. }
  951. }
  952. .coupon {
  953. height: 100%;
  954. }
  955. /*优惠券列表公共*/
  956. .coupon-list {}
  957. .coupon-list .item {
  958. display: flex;
  959. flex-direction: column;
  960. justify-content: center;
  961. align-items: center;
  962. width: 100%;
  963. height: 1.7 * 100rpx;
  964. margin-bottom: 0.16 * 100rpx;
  965. }
  966. .coupon-list .item .money {
  967. background-size: 100% 100%;
  968. width: 2.4 * 100rpx;
  969. height: 100%;
  970. color: #fff;
  971. font-size: 0.36 * 100rpx;
  972. font-weight: bold;
  973. text-align: center;
  974. display: flex;
  975. flex-direction: column;
  976. align-items: center;
  977. justify-content: center;
  978. position: relative;
  979. }
  980. .coupon-list .item .money .img {
  981. position: absolute;
  982. width: 2.4 * 100rpx;
  983. height: 100%;
  984. color: #fff;
  985. }
  986. .coupon-list .item .money .num {
  987. font-size: 0.6 * 100rpx;
  988. }
  989. .coupon-list .item .money .pic-num {
  990. font-size: 20rpx;
  991. z-index: 99;
  992. }
  993. .coupon-list .item .text {
  994. width: 4.5 * 100rpx;
  995. padding: 0 0.17 * 100rpx 0 0.24 * 100rpx;
  996. background-color: #fff;
  997. box-sizing: border-box;
  998. }
  999. .coupon-list .item .text .condition {
  1000. font-size: 0.3 * 100rpx;
  1001. color: #282828;
  1002. height: 0.93 * 100rpx;
  1003. line-height: 0.93 * 100rpx;
  1004. border-bottom: 1px solid #f0f0f0;
  1005. }
  1006. .coupon-list .item .text .data {
  1007. font-size: 0.2 * 100rpx;
  1008. color: #999;
  1009. height: 0.76 * 100rpx;
  1010. }
  1011. .coupon-list .item .text .data .bnt {
  1012. width: 1.36 * 100rpx;
  1013. height: 0.44 * 100rpx;
  1014. border-radius: 0.22 * 100rpx;
  1015. font-size: 0.22 * 100rpx;
  1016. color: #fff;
  1017. text-align: center;
  1018. line-height: 0.44 * 100rpx;
  1019. background-color: red;
  1020. }
  1021. >>>>>>> 8c8ec24aaf25141f3a66af3c1d21e5415ce32117
  1022. </style>