createOrder.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. <template>
  2. <view class="content padding-t-30">
  3. <view class="flex tab-address goodsList">
  4. <view class="left">
  5. 收货方式
  6. </view>
  7. <view class="flex right">
  8. <view class=" item" :class="{action:tabCurrentIndex==1}" @click="tabCurrentIndex=1">
  9. 配送
  10. </view>
  11. <view class=" item" :class="{action:tabCurrentIndex==2}" @click="tabCurrentIndex=2">
  12. 自提
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 地址 -->
  17. <navigator v-if="tabCurrentIndex == 1" url="/pages/set/address?source=1" class="address-section margin-b-30">
  18. <view class="order-content " v-if="addressData.real_name">
  19. <view class="cen">
  20. <view class="top">
  21. <text class="name">{{ addressData.real_name }}</text>
  22. <text class="mobile">{{ addressData.phone }}</text>
  23. </view>
  24. <text
  25. class="address flex">{{ addressData.province + addressData.city + addressData.district }}{{ addressData.detail }}</text>
  26. </view>
  27. <text class="iconfont iconenter"></text>
  28. </view>
  29. <view class="order-content" v-if="!addressData.real_name">
  30. <view class="addAddress">
  31. <text></text>
  32. <text>添加收货地址</text>
  33. </view>
  34. </view>
  35. </navigator>
  36. <navigator url="/pages/order/shopList?type=1" class="address-section">
  37. <view class="shop-box" v-if="shopAddress.name">
  38. <view class="shop-top flex">
  39. <view class="flex shop-title">
  40. <image class="shopImg" :src="shopAddress.image" mode="scaleToFill"></image>
  41. <view class="shop-name clamp2">{{ shopAddress.name }}</view>
  42. </view>
  43. <view class="shop-tip">
  44. 门店
  45. </view>
  46. </view>
  47. <view class="shop-content margin-t-10">
  48. <view class="shop-address">
  49. 电话:{{ shopAddress.phone }}
  50. </view>
  51. <text class="shop-address">
  52. 地区:{{shopAddress.address+shopAddress.detailed_address}}
  53. </text>
  54. </view>
  55. </view>
  56. <view class="order-content" v-if="!shopAddress.name">
  57. <view class="addAddress">
  58. <text></text>
  59. <text>添加收货地址</text>
  60. </view>
  61. </view>
  62. </navigator>
  63. <view class="goodsList">
  64. <view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
  65. <!-- 商品列表 -->
  66. <view class="g-item">
  67. <image :src="ls.productInfo.image"></image>
  68. <view class="right">
  69. <text class="title clamp">{{ ls.productInfo.store_name }}</text>
  70. <text class="spec">{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.suk : '默认' }}</text>
  71. <view class="price-box">
  72. <text
  73. class="price">¥{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price }}</text>
  74. <text class="number">{{ 'x ' + ls.cart_num + (ls.productInfo.unit_name || '') }}</text>
  75. </view>
  76. <view class="serverSet" v-if="ls.day>0">
  77. (<text>服务费:{{ls.day_deducted}}</text>
  78. <text class="margin-l-10">服务天数:{{ls.day}}天</text>)
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 金额明细 -->
  85. <view class="yt-list">
  86. <view class="yt-list-cell b-b" v-if="certificate_info.num>0">
  87. <text class="cell-tit clamp">使用卡券({{certificate_info.num}})</text>
  88. <view class="desc">
  89. <switch class="switchCard" :checked='certificate_info.checked' style="transform:scale(0.7)"
  90. @change="switchChange" />
  91. </view>
  92. </view>
  93. <template v-if="tabCurrentIndex == 1">
  94. <view class="yt-list-cell b-b">
  95. <text class="cell-tit clamp">送货日期</text>
  96. <view @click="openTime" class="desc">
  97. <text v-if="day.day">
  98. {{timeList[checkedTime].name+day.time}}
  99. </text>
  100. <text v-else>
  101. 请选择送货日期
  102. </text>
  103. </view>
  104. </view>
  105. </template>
  106. <template v-if="tabCurrentIndex == 2">
  107. <view class="yt-list-cell b-b">
  108. <text class="cell-tit clamp">姓名</text>
  109. <input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写姓名"
  110. placeholder-class="placeholder" />
  111. </view>
  112. <view class="yt-list-cell b-b">
  113. <text class="cell-tit clamp">手机号</text>
  114. <input class="desc" type="text" v-model="addressData.phone" placeholder="请填写手机号"
  115. placeholder-class="placeholder" />
  116. </view>
  117. </template>
  118. <view class="yt-list-cell b-b">
  119. <text class="cell-tit clamp">运费</text>
  120. <text class="cell-tip disabled">{{ Postage }}</text>
  121. </view>
  122. <view class="yt-list-cell b-b">
  123. <text class="cell-tit clamp">备注</text>
  124. <input class="desc" type="text" v-model="desc" placeholder="请填写备注信息" placeholder-class="placeholder" />
  125. </view>
  126. </view>
  127. <view class="yt-list">
  128. <view class="yt-list-cell b-b" @click="payType='weixin'">
  129. <view class="cell-tit flex">
  130. <image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
  131. <text class="margin-l-10">微信支付</text>
  132. </view>
  133. <image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
  134. mode="widthFix"></image>
  135. <view v-else class="noChecked"></view>
  136. </view>
  137. <!-- #ifdef APP-PLUS -->
  138. <view class="yt-list-cell b-b" @click="payType='ali'">
  139. <view class="cell-tit flex">
  140. <image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
  141. <text class="margin-l-10">支付宝</text>
  142. </view>
  143. <image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  144. </image>
  145. <view v-else class="noChecked"></view>
  146. </view>
  147. <!-- #endif -->
  148. <view class="yt-list-cell b-b" @click="payType='yue'">
  149. <view class="cell-tit flex">
  150. <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
  151. <text class="margin-l-10">余额({{now_money}})</text>
  152. </view>
  153. <image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  154. </image>
  155. <view v-else class="noChecked"></view>
  156. </view>
  157. <view class="yt-list-cell b-b" v-if="!certificate_info.checked" @click="payType='offline'">
  158. <view class="cell-tit flex">
  159. <image class="orderIcon" src="../../static/icon/yh.png" mode="widthFix"></image>
  160. <text class="margin-l-10">线下支付</text>
  161. </view>
  162. <image class="checked" v-if="payType=='offline'" src="../../static/icon/addressIconXz.png"
  163. mode="widthFix">
  164. </image>
  165. <view v-else class="noChecked"></view>
  166. </view>
  167. </view>
  168. <!-- 底部 -->
  169. <view class="footer">
  170. <view class="price-content">
  171. <text>实付款</text>
  172. <text class="price-tip">¥</text>
  173. <text class="price">{{ payPrice }}</text>
  174. </view>
  175. <text class="submit" :class="{submitNo:payLoding}" @click="payLoding?'':submit()">提交订单</text>
  176. </view>
  177. <uni-popup class="alertTime" ref="popup" type="bottom">
  178. <view class="alert-box position-relative">
  179. <view class="alert-title ">
  180. 选择预计送达时间
  181. </view>
  182. <view class="tip iconfont iconclose" @click="$refs.popup.close()"></view>
  183. <view class="flex">
  184. <view class="left-title">
  185. <view class="title" :class="{action:checkedTime==ind}" v-for="(item,ind) in timeList"
  186. @click="changeCheckedTime(item,ind)">
  187. {{item.name+'('+item.day+')'}}
  188. </view>
  189. </view>
  190. <view class="right-content">
  191. <view class="list flex" v-for="(item,ind) in timeList[checkedTime].list"
  192. @click="checkedShopTime(item)">
  193. <view class="time">
  194. {{item.time}}
  195. </view>
  196. <view class="checked">
  197. 剩余:{{item.door_number-item.day_number}}
  198. </view>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </uni-popup>
  204. </view>
  205. </template>
  206. <script>
  207. import {
  208. mapState
  209. } from 'vuex';
  210. import {
  211. confirm,
  212. computedOrderkey,
  213. createOrderkey,
  214. orderPay
  215. } from '@/api/order.js';
  216. import {
  217. getUserInfo
  218. } from '@/api/user.js';
  219. import {
  220. storeday
  221. } from '@/api/water.js';
  222. // #ifdef H5
  223. import weixinObj from "@/plugin/jweixin-module/index.js";
  224. // #endif
  225. export default {
  226. data() {
  227. return {
  228. tabCurrentIndex: 1, //1为自提2为配送
  229. // #ifdef APP
  230. payType: 'ali',
  231. // #endif
  232. // #ifndef APP
  233. payType: 'weixin',
  234. // #endif
  235. desc: '', //备注
  236. // 收货地址
  237. addressData: {},
  238. // 店铺地址
  239. shopAddress: {
  240. name: '',
  241. mobile: '',
  242. addressName: '',
  243. address: '',
  244. area: '',
  245. default: false,
  246. id: ''
  247. },
  248. // 商品列表
  249. shopList: [],
  250. // 购物车id
  251. cartId: '',
  252. //购物金额详情
  253. moneyAll: {
  254. storeFreePostage: 0, //邮费优惠
  255. storePostage: 0, //邮费
  256. totalPrice: 0, //总支付金额
  257. vipPrice: 0 //vip优惠价
  258. },
  259. payPrice: 0, //总支付金额
  260. orderKey: '', //订单id
  261. payLoding: false, //判断是否支付中
  262. orderId: '', //订单id
  263. now_money: 0, //余额
  264. onShopId: -1, //默认-1为不存在商家id
  265. // 下单日期
  266. day: {
  267. day: '',
  268. id: '',
  269. time: ''
  270. },
  271. // 当前选中的日期对象
  272. checkedTime: 0,
  273. // 保存每周日子
  274. timeName: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  275. // 保存日期列表
  276. timeList: [{
  277. name: '今天',
  278. day: '',
  279. time: '',
  280. list: []
  281. }, {
  282. name: '明天',
  283. day: '',
  284. time: '',
  285. list: []
  286. }, {
  287. name: '',
  288. day: '',
  289. time: '',
  290. list: []
  291. }, {
  292. name: '',
  293. day: '',
  294. time: '',
  295. list: []
  296. }],
  297. // 可使用的水票
  298. certificate_info: {
  299. id: '',
  300. num: 0,
  301. checked: false
  302. }
  303. };
  304. },
  305. watch: {
  306. shopAddress(newValue, oldValue) {
  307. console.log(newValue, 'newValue');
  308. for (let i = 0; i < this.timeList.length; i++) {
  309. const item = this.timeList[i];
  310. const day = `${item.time.getFullYear()}-${item.time.getMonth()+1}-${item.time.getDate()}`
  311. storeday({
  312. store_id: newValue.id,
  313. day
  314. }).then(({
  315. data
  316. }) => {
  317. item.list = data;
  318. });
  319. }
  320. }
  321. },
  322. onLoad(option) {
  323. // 保存当前商品在购物车中的id
  324. this.cartId = option.id;
  325. // 判断是否要读取商家id
  326. if (option.shopId) {
  327. this.onShopId = option.shopId;
  328. }
  329. this.loadData();
  330. this.userinfo();
  331. // 初始化送货时间
  332. this.timeInit();
  333. },
  334. computed: {
  335. // 计算是否免运费
  336. Postage() {
  337. let money = +this.moneyAll.storePostage;
  338. if (money == 0) {
  339. return '免运费';
  340. } else {
  341. return '¥' + money;
  342. }
  343. },
  344. payAllMoney() {
  345. return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
  346. },
  347. },
  348. methods: {
  349. // 是否使用卡券切换
  350. switchChange(res) {
  351. this.certificate_info.checked = res.detail.value;
  352. if (this.payType == 'offline') {
  353. this.payType = 'weixin'
  354. }
  355. // 重新计算价格
  356. this.payMoneyNub();
  357. },
  358. checkedShopTime(item) {
  359. if (item.door_number - item.day_number == 0) {
  360. uni.showModal({
  361. title: '提示',
  362. content: '该时间段预约已满!',
  363. showCancel: false,
  364. });
  365. return
  366. }
  367. this.day = item;
  368. this.$refs.popup.close();
  369. },
  370. // 选中的时间对象
  371. changeCheckedTime(item, ind) {
  372. this.checkedTime = ind;
  373. },
  374. // 打开弹窗
  375. openTime() {
  376. // 打开弹出窗
  377. this.$refs.popup.open();
  378. },
  379. // 初始化送货时间
  380. timeInit() {
  381. // 保存当前时间
  382. const startTime = new Date();
  383. for (let i = 0; i < this.timeList.length; i++) {
  384. const item = this.timeList[i]
  385. // 保存今天时间戳
  386. item.time = new Date(startTime.getTime() + 86400000 * i);
  387. // 获取今日周几
  388. item.day = this.timeName[item.time.getDay()];
  389. if (!item.name) {
  390. // 获取今日日期
  391. item.name = `${item.time.getMonth()+1}月${item.time.getDate()}日`
  392. }
  393. }
  394. console.log(this.timeList, 'this.timeList');
  395. },
  396. // 送货时间修改
  397. changeTime(res) {
  398. console.log(res);
  399. },
  400. // 加载用户基础信息
  401. userinfo() {
  402. getUserInfo({}).then(({
  403. data
  404. }) => {
  405. this.now_money = data.now_money;
  406. });
  407. },
  408. // 计算支付金额
  409. payMoneyNub() {
  410. let updata = {
  411. orderkey: this.orderKey,
  412. useIntegral: 0, //是否积分抵扣
  413. addressId: this.addressData.id //地址编号
  414. }
  415. // 判断是卡券支付
  416. if (this.certificate_info.checked) {
  417. updata.use_certificate_id = this.certificate_info.id
  418. }
  419. computedOrderkey(updata)
  420. .then(({
  421. data
  422. }) => {
  423. this.integralShow = true;
  424. // 获取支付金额
  425. this.payPrice = +data.result.pay_price;
  426. this.integralMoney = data.result.deduction_price;
  427. })
  428. .catch(e => {
  429. console.log(e);
  430. this.integralShow = false;
  431. });
  432. },
  433. // 加载基础数据
  434. loadData() {
  435. let obj = this;
  436. confirm({
  437. cartId: obj.cartId + '',
  438. longitude: uni.getStorageSync('CACHE_LONGITUDE'),
  439. latitude: uni.getStorageSync('CACHE_LATITUDE'),
  440. }).then(({
  441. data
  442. }) => {
  443. obj.certificate_info.id = data.certificate_info.id;
  444. obj.certificate_info.num = data.certificate_info.num;
  445. obj.addressData = data.addressInfo || {};
  446. obj.shopList = data.cartInfo; //商品列表
  447. obj.moneyAll = data.priceGroup; //金额数据
  448. obj.orderKey = data.orderKey; //订单key
  449. obj.shopAddress = data.system_store; //到店自提列表
  450. obj.shopAddress.address = data.system_store.address.join(','); //到店自提列表
  451. // 计算金额
  452. this.payMoneyNub();
  453. });
  454. },
  455. // 提交订单
  456. submit() {
  457. let obj = this;
  458. if (!this.addressData.real_name) {
  459. this.$api.msg('请选择收货地址');
  460. return false;
  461. }
  462. if (!this.addressData.phone) {
  463. this.$api.msg('请填写手机号');
  464. return false;
  465. }
  466. // 判断是否余额不足
  467. if (obj.payType == 'yue' && +obj.now_money < obj.payPrice) {
  468. uni.showModal({
  469. title: '提示',
  470. content: '账户余额不足!',
  471. showCancel: false,
  472. });
  473. return;
  474. }
  475. if (!obj.day.day&&obj.tabCurrentIndex==1) {
  476. uni.showModal({
  477. title: '提示',
  478. content: '请选择送水时间!',
  479. showCancel: false,
  480. });
  481. return
  482. }
  483. uni.showLoading({
  484. title: '支付中',
  485. mask: true
  486. })
  487. // 支付中
  488. obj.payLoding = true;
  489. // 判断是否为未支付订单中跳转进入
  490. obj.firstCreateOrder();
  491. },
  492. // 订单金额支付
  493. orderMoneyPay() {
  494. let obj = this;
  495. orderPay({
  496. uni: obj.orderId,
  497. // #ifdef H5
  498. from: 'weixin', //来源
  499. // #endif
  500. // #ifdef MP-WEIXIN
  501. from: 'routine', //来源
  502. // #endif
  503. // #ifdef APP-PLUS
  504. from: 'app', //来源
  505. // #endif
  506. paytype: obj.payType //支付类型 weixin-微信 yue-余额
  507. })
  508. .then(e => {
  509. // 判断是否微信小程序支付
  510. if (obj.payType == 'weixin') {
  511. // #ifdef H5 || MP
  512. let da = e.data.result.jsConfig;
  513. let data = {
  514. nonceStr: da.nonceStr,
  515. package: da.package,
  516. signType: da.signType,
  517. paySign: da.paySign,
  518. success: function(res) {
  519. obj.paySuccessTo();
  520. },
  521. fail: () => {
  522. uni.navigateTo({
  523. url: '/pages/order/order?state=0'
  524. });
  525. }
  526. };
  527. // #endif
  528. // #ifdef H5
  529. data.timestamp = da.timestamp;
  530. weixinObj.chooseWXPay(data);
  531. // #endif
  532. // #ifdef MP-WEIXIN
  533. data.timeStamp = da.timestamp;
  534. wx.requestPayment(data);
  535. // #endif
  536. // #ifdef APP
  537. console.log(e.data.result.jsConfig, '返回数值');
  538. uni.requestPayment({
  539. provider: 'wxpay',
  540. orderInfo: e.data.result.jsConfig,
  541. success(e) {
  542. obj.paySuccessTo();
  543. },
  544. fail: (e) => {
  545. console.log(e, '支付失败');
  546. uni.navigateTo({
  547. url: '/pages/order/order?state=0'
  548. });
  549. }
  550. })
  551. // #endif
  552. }
  553. // #ifdef APP
  554. if (obj.payType == 'ali') {
  555. uni.requestPayment({
  556. provider: 'alipay',
  557. orderInfo: e.data.result.jsConfig,
  558. success(e) {
  559. obj.paySuccessTo();
  560. },
  561. fail: (e) => {
  562. console.log(e, '支付失败');
  563. uni.navigateTo({
  564. url: '/pages/order/order?state=0'
  565. });
  566. }
  567. })
  568. }
  569. // #endif
  570. uni.hideLoading();
  571. obj.payLoding = false;
  572. })
  573. .catch(e => {
  574. // 支付完成
  575. uni.hideLoading();
  576. obj.payLoding = false;
  577. console.log(e);
  578. });
  579. },
  580. // 支付成功跳转
  581. paySuccessTo() {
  582. uni.hideLoading();
  583. uni.redirectTo({
  584. url: '/pages/user/money/paySuccess?orderid=' + this.orderId,
  585. });
  586. },
  587. // 初次订单创建
  588. firstCreateOrder() {
  589. let obj = this;
  590. console.log(obj.day, 'obj.day');
  591. let data = {
  592. real_name: obj.addressData.real_name, //联系人名称
  593. phone: obj.addressData.phone, //联系人号码
  594. addressId: obj.addressData.id, //支付地址id
  595. useIntegral: 0, //是否积分抵扣1为是0为否
  596. payType: obj.payType, //支付类型 weixin-微信 yue-余额
  597. mark: obj.desc, //备注
  598. // #ifdef H5
  599. from: 'weixin', //来源
  600. // #endif
  601. // #ifdef MP-WEIXIN
  602. from: 'routine', //来源
  603. // #endif
  604. // #ifdef APP-PLUS
  605. from: 'app', //来源
  606. // #endif
  607. shipping_type: obj.tabCurrentIndex, //提货方式 1 快递 2自提
  608. store_id: obj.shopAddress.id || '',
  609. day: obj.day.day,
  610. door_id: obj.day.door_id
  611. };
  612. if (obj.certificate_info.checked) {
  613. data.use_certificate_id = obj.certificate_info.id
  614. }
  615. // 生成订单
  616. createOrderkey(data, obj.orderKey)
  617. .then(({
  618. data,
  619. status,
  620. msg
  621. }) => {
  622. // 判断是否支付失败
  623. if (data.status == 'ORDER_EXIST') {
  624. uni.showModal({
  625. title: '提示',
  626. content: msg,
  627. showCancel: false
  628. });
  629. uni.hideLoading();
  630. obj.payLoding = false;
  631. return;
  632. }
  633. // 保存订单号
  634. obj.orderId = data.result.orderId;
  635. if(obj.certificate_info.checked&&obj.payPrice==0){
  636. if (status == 200 && data.status == 'SUCCESS') {
  637. obj.paySuccessTo();
  638. } else {
  639. obj.$api.msg(msg);
  640. }
  641. return
  642. }
  643. // 判断是否为余额支付
  644. if (obj.payType == 'yue' || obj.payType == 'offline') {
  645. if (status == 200 && data.status == 'SUCCESS') {
  646. obj.paySuccessTo();
  647. } else {
  648. obj.$api.msg(msg);
  649. }
  650. } else {
  651. // 立即支付
  652. obj.orderMoneyPay();
  653. }
  654. })
  655. .catch(e => {
  656. uni.hideLoading();
  657. obj.payLoding = false;
  658. console.log(e);
  659. });
  660. }
  661. }
  662. };
  663. </script>
  664. <style lang="scss">
  665. .content {
  666. padding-bottom: 100rpx;
  667. }
  668. .address-section {
  669. border-radius: 20rpx;
  670. padding: 30rpx;
  671. margin: 0 $page-row-spacing;
  672. background: #fff;
  673. position: relative;
  674. .order-content {
  675. min-height: 100rpx;
  676. display: flex;
  677. align-items: center;
  678. .leftIcon {
  679. width: 36rpx;
  680. margin: 0 30rpx;
  681. }
  682. .addAddress {
  683. text-align: center;
  684. width: 100%;
  685. display: flex;
  686. justify-content: center;
  687. align-items: center;
  688. }
  689. }
  690. .cen {
  691. display: flex;
  692. flex-direction: column;
  693. font-size: 28rpx;
  694. color: $font-color-dark;
  695. width: 0px;
  696. flex-grow: 1;
  697. }
  698. .name {
  699. font-size: 34rpx;
  700. margin-right: 24rpx;
  701. }
  702. .address {
  703. margin-top: 16rpx;
  704. margin-right: 20rpx;
  705. color: $font-color-light;
  706. }
  707. }
  708. .goodsList {
  709. margin: 0 $page-row-spacing;
  710. padding: 30rpx;
  711. background: #fff;
  712. border-radius: 20rpx;
  713. margin-top: 30rpx;
  714. }
  715. .goods-section {
  716. .logo {
  717. display: block;
  718. width: 50rpx;
  719. height: 50rpx;
  720. border-radius: 100px;
  721. }
  722. .name {
  723. font-size: 30rpx;
  724. color: $font-color-base;
  725. margin-left: 24rpx;
  726. }
  727. .g-item {
  728. display: flex;
  729. image {
  730. flex-shrink: 0;
  731. display: block;
  732. width: 170rpx;
  733. height: 170rpx;
  734. border-radius: 4rpx;
  735. }
  736. .right {
  737. flex: 1;
  738. padding-left: 24rpx;
  739. overflow: hidden;
  740. .serverSet {
  741. font-size: 22rpx;
  742. color: $font-color-light;
  743. }
  744. }
  745. .title {
  746. font-size: 30rpx;
  747. color: $font-color-dark;
  748. }
  749. .spec {
  750. font-size: 26rpx;
  751. color: $font-color-light;
  752. }
  753. .price-box {
  754. display: flex;
  755. align-items: center;
  756. font-size: 32rpx;
  757. padding-top: 10rpx;
  758. color: $font-color-light;
  759. .price {
  760. margin-bottom: 4rpx;
  761. }
  762. .number {
  763. font-size: 26rpx;
  764. margin-left: 20rpx;
  765. }
  766. }
  767. .step-box {
  768. position: relative;
  769. }
  770. }
  771. }
  772. .yt-list {
  773. background: #fff;
  774. margin: 0 $page-row-spacing;
  775. margin-top: 30rpx;
  776. border-radius: 20rpx;
  777. }
  778. .yt-list-cell {
  779. display: flex;
  780. align-items: center;
  781. justify-content: space-between;
  782. padding: 10rpx 30rpx 10rpx 40rpx;
  783. line-height: 70rpx;
  784. position: relative;
  785. .checked,
  786. .noChecked {
  787. width: 36rpx;
  788. height: 36rpx;
  789. }
  790. .noChecked {
  791. border: 1px solid $font-color-light;
  792. border-radius: 100rpx;
  793. }
  794. &.cell-hover {
  795. background: #fafafa;
  796. }
  797. &.b-b:after {
  798. left: 30rpx;
  799. }
  800. .cell-icon {
  801. height: 32rpx;
  802. width: 32rpx;
  803. font-size: 22rpx;
  804. color: #fff;
  805. text-align: center;
  806. line-height: 32rpx;
  807. background: #f85e52;
  808. border-radius: 4rpx;
  809. margin-right: 12rpx;
  810. &.hb {
  811. background: #ffaa0e;
  812. }
  813. &.lpk {
  814. background: #3ab54a;
  815. }
  816. }
  817. .cell-more {
  818. align-self: center;
  819. font-size: 24rpx;
  820. color: $font-color-light;
  821. margin-left: 8rpx;
  822. margin-right: -10rpx;
  823. }
  824. .cell-tit {
  825. font-size: 26rpx;
  826. color: $font-color-light;
  827. margin-right: 10rpx;
  828. .orderIcon {
  829. width: 48rpx;
  830. }
  831. }
  832. .cell-tip {
  833. font-size: 26rpx;
  834. color: $font-color-dark;
  835. &.disabled {
  836. color: $font-color-light;
  837. }
  838. &.active {
  839. color: $base-color;
  840. }
  841. &.red {
  842. color: $base-color;
  843. }
  844. }
  845. &.desc-cell {
  846. .cell-tit {
  847. max-width: 90rpx;
  848. }
  849. }
  850. .desc {
  851. text-align: right;
  852. font-size: $font-base;
  853. color: $font-color-light;
  854. .switchCard {
  855. margin-right: -20rpx;
  856. }
  857. }
  858. }
  859. /* 支付列表 */
  860. .pay-list {
  861. padding-left: 40rpx;
  862. margin-top: 16rpx;
  863. background: #fff;
  864. .pay-item {
  865. display: flex;
  866. align-items: center;
  867. padding-right: 20rpx;
  868. line-height: 1;
  869. height: 110rpx;
  870. position: relative;
  871. }
  872. .icon-weixinzhifu {
  873. width: 80rpx;
  874. font-size: 40rpx;
  875. color: #6bcc03;
  876. }
  877. .icon-alipay {
  878. width: 80rpx;
  879. font-size: 40rpx;
  880. color: #06b4fd;
  881. }
  882. .icon-xuanzhong2 {
  883. display: flex;
  884. align-items: center;
  885. justify-content: center;
  886. width: 60rpx;
  887. height: 60rpx;
  888. font-size: 40rpx;
  889. color: $base-color;
  890. }
  891. .tit {
  892. font-size: 32rpx;
  893. color: $font-color-dark;
  894. flex: 1;
  895. }
  896. }
  897. .footer {
  898. position: fixed;
  899. left: 0;
  900. bottom: 0;
  901. z-index: 995;
  902. display: flex;
  903. align-items: center;
  904. width: 100%;
  905. height: 90rpx;
  906. justify-content: space-between;
  907. font-size: 30rpx;
  908. background-color: #fff;
  909. z-index: 998;
  910. color: $font-color-base;
  911. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  912. .price-content {
  913. padding-left: 30rpx;
  914. }
  915. .price-tip {
  916. color: $font-color-base;
  917. margin-left: 8rpx;
  918. }
  919. .price {
  920. font-size: 36rpx;
  921. color: $font-color-base;
  922. }
  923. .submit {
  924. display: flex;
  925. align-items: center;
  926. justify-content: center;
  927. width: 280rpx;
  928. height: 100%;
  929. color: #fff;
  930. font-size: 32rpx;
  931. background: $bg-gradual;
  932. &.submitNo {
  933. background-color: $font-color-disabled;
  934. }
  935. }
  936. }
  937. .tab-address {
  938. margin-bottom: 30rpx;
  939. margin-top: 0;
  940. .left {
  941. font-size: $font-base;
  942. }
  943. .right {
  944. font-size: $font-sm;
  945. color: #FFF;
  946. background: $bg-gradual;
  947. padding: 6rpx;
  948. border-radius: 10rpx;
  949. line-height: 1;
  950. .item {
  951. padding: 16rpx 20rpx;
  952. &.action {
  953. color: $uni-color-primary;
  954. background-color: #FFF;
  955. border-radius: 10rpx;
  956. }
  957. }
  958. }
  959. }
  960. .shop-box {
  961. .shop-top {
  962. width: 100%;
  963. .shop-title {
  964. width: 0px;
  965. flex-grow: 1;
  966. justify-content: flex-start;
  967. .shopImg {
  968. height: 65rpx;
  969. width: 65rpx;
  970. border-radius: 100rpx;
  971. margin-right: 20rpx;
  972. flex-shrink: 0;
  973. }
  974. .shop-name {
  975. font-weight: bold;
  976. font-size: $font-lg;
  977. }
  978. }
  979. .shop-tip {
  980. color: #FFF;
  981. padding: 5rpx 10rpx;
  982. font-size: $font-sm;
  983. background: linear-gradient(-90deg, #DCB876 0%, #EECD92 100%);
  984. border-radius: 5rpx;
  985. }
  986. }
  987. .shop-content {
  988. color: $font-color-light;
  989. font-size: $font-sm;
  990. }
  991. }
  992. .alertTime {
  993. z-index: 1000;
  994. .alert-box {
  995. background-color: #FFF;
  996. border-top-right-radius: 20rpx;
  997. border-top-left-radius: 20rpx;
  998. .right-content {
  999. width: 70%;
  1000. .list {
  1001. padding: 20rpx 30rpx;
  1002. font-size: $font-sm;
  1003. border-bottom: 1px solid $border-color-light;
  1004. }
  1005. }
  1006. .left-title {
  1007. width: 30%;
  1008. align-self: flex-start;
  1009. .title {
  1010. padding: 30rpx;
  1011. text-align: center;
  1012. font-weight: bold;
  1013. font-size: $font-sm;
  1014. background-color: rgba(246, 246, 246, 1);
  1015. &.action {
  1016. background-color: #FFF;
  1017. }
  1018. }
  1019. }
  1020. .alert-title {
  1021. text-align: center;
  1022. padding: 30rpx;
  1023. line-height: 1;
  1024. font-weight: bold;
  1025. }
  1026. .tip {
  1027. position: absolute;
  1028. top: 30rpx;
  1029. right: 30rpx;
  1030. color: $font-color-disabled;
  1031. font-weight: bold;
  1032. }
  1033. }
  1034. }
  1035. ::v-deep .uni-switch-input {
  1036. &.uni-switch-input-checked {
  1037. border-color: $base-color !important;
  1038. background-color: $base-color !important;
  1039. }
  1040. }
  1041. </style>