rent.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. <template>
  2. <view class="content">
  3. <view class="qrimg">
  4. <tki-qrcode :cid="cid" ref="qrcode" :val="val" :size="size" :unit="unit" :background="background"
  5. :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconSize" :lv="lv" :onval="onval"
  6. :showLoading="showLoading" :loadMake="loadMake" :usingComponents="usingComponents" @result="qrR" />
  7. </view>
  8. <view class="top-tit">
  9. <view class="tit">
  10. 为您展示【台州市】地区套餐,其他地域套餐待开放。
  11. </view>
  12. </view>
  13. <!-- 推荐渠道 -->
  14. <view class="yt-list">
  15. <view class="top-wrap flex">
  16. <view class="top-left">
  17. 推荐渠道
  18. </view>
  19. </view>
  20. <view class="contet-list flex">
  21. <view class="tc " style="display: flex;text-align: center;" :class="{'action': is_tj}"
  22. @click="couldTj?istj==true:''">
  23. 推荐渠道
  24. </view>
  25. <view class="tc" style="display: flex;text-align: center;" :class="{'action': !is_tj}">
  26. {{isFj?'最近门店': '选择门店'}}
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 门店选择 -->
  31. <view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')" v-if="!is_tj">
  32. <view class="top-wrap flex">
  33. <view class="top-left">
  34. {{isFj?'最近门店': '选择门店'}}
  35. </view>
  36. </view>
  37. <view class="store-wrap flex" v-if="selctStore && selctStore.id">
  38. <view class="imgBox">
  39. <image class="logo" :src="selctStore.image" mode="aspectFit"></image>
  40. </view>
  41. <view class="padding-l-20 flex-grow-true">
  42. <view class="title clamp flex">
  43. <view class="name">
  44. {{selctStore.name}}
  45. </view>
  46. <view class="km" v-if="selctStore.range">
  47. {{selctStore.range<1?selctStore.distance+'m':selctStore.range+'km'}}
  48. </view>
  49. </view>
  50. <view class="flex addressBox margin-t-20">
  51. <image class="iconA margin-r-10" src="../../static/icon/shop.png" mode="">
  52. </image>
  53. <text class="clamp">
  54. {{selctStore.detailed_address}}
  55. </text>
  56. </view>
  57. <view class="addressBox flex">
  58. <image class="iconA margin-r-10" src="../../static/icon/shopPhone.png" mode="">
  59. <text class="clamp">
  60. {{selctStore.phone}}
  61. </text>
  62. </view>
  63. <view class="yysj">
  64. 营业时间:{{selctStore.day_time}}
  65. </view>
  66. </view>
  67. </view>
  68. <view class="store-wrap-empty" v-else>
  69. 选择门店
  70. </view>
  71. </view>
  72. <!-- 套餐 -->
  73. <view class="tc-wrap">
  74. <view class="top-wrap flex">
  75. <view class="top-left">
  76. 选择套餐
  77. </view>
  78. </view>
  79. <view class="contet-list flex">
  80. <view class="tc flex" v-for="(item,index) in tcList" :class="{'action': selectTcIndex == index}"
  81. @click="choosTc(index,item)">
  82. <view class="tc-price">
  83. {{item.price}}
  84. <text class="tc-time-t">
  85. &nbsp;/&nbsp;{{item.day}}天
  86. </text>
  87. </view>
  88. <view class="tc-time-price">
  89. <text>{{(item.price*1/(item.day*1)).toFixed(2)}}</text>元/天
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="dy-wrap" v-if="selectTc.id && userInfo.battery_deposit != 1">
  95. <view class="top-wrap flex">
  96. <view class="top-left">
  97. 押金服务
  98. </view>
  99. <!-- <view class="top-right">
  100. <text>押金规则</text>
  101. <image src="../../static/icon/next1.png" mode="heightFix"></image>
  102. </view> -->
  103. </view>
  104. <view class="contet-list flex">
  105. <!-- <view class="tc flex dy">
  106. <view class="tc-time">
  107. <image src="../../static/icon/orderWx.png" mode="heightFix"></image>微信信用免押金
  108. </view>
  109. <view class="tc-time-price">
  110. 微信信用≥550分
  111. </view>
  112. <view class="tc-price">
  113. 77<text>¥88</text>
  114. </view>
  115. </view> -->
  116. <view class="tc flex dy action">
  117. <view class="tc-time">
  118. 支付押金
  119. </view>
  120. <!-- <view class="tc-time-price">
  121. 元/天
  122. </view> -->
  123. <view class="tc-price">
  124. {{selectTc.deposit}}
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="dy-wrap">
  130. <view class="top-wrap flex">
  131. <view class="top-left">
  132. 使用说明
  133. </view>
  134. </view>
  135. <view class="sysm" v-html="sm">
  136. </view>
  137. </view>
  138. <view class="yt-list">
  139. <view class="yt-list-cell b-b" @click="payType='weixin'">
  140. <view class="cell-tit flex">
  141. <image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
  142. <text class="margin-l-10">微信支付</text>
  143. </view>
  144. <image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
  145. mode="widthFix"></image>
  146. <view v-else class="noChecked"></view>
  147. </view>
  148. <!-- #ifdef APP-PLUS -->
  149. <view class="yt-list-cell b-b" @click="payType='ali'">
  150. <view class="cell-tit flex">
  151. <image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
  152. <text class="margin-l-10">支付宝</text>
  153. </view>
  154. <image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  155. </image>
  156. <view v-else class="noChecked"></view>
  157. </view>
  158. <!-- #endif -->
  159. <view class="yt-list-cell b-b" @click="payType='yue'">
  160. <view class="cell-tit flex">
  161. <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
  162. <text class="margin-l-10">卡券({{now_money}})</text>
  163. </view>
  164. <image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  165. </image>
  166. <view v-else class="noChecked"></view>
  167. </view>
  168. </view>
  169. <view class="ts">
  170. </view>
  171. <!-- <view class="btm-btn flex">
  172. <view class="pay-price" >
  173. 总计费用:<text>{{(selectTc.price*1) || ''}}</text>
  174. </view>
  175. <view class="pay-btn" @click="toBuy" :class="{'zfz': loading}">
  176. {{loading?'支付中':'立即支付'}}
  177. </view>
  178. </view> -->
  179. <view class="btm-btn flex" v-if="!showbtn">
  180. <view class="pay-price">
  181. 总计费用:<text>{{(selectTc.price*1) || ''}}</text>
  182. </view>
  183. <view class="pay-btn" @click="getEwm">
  184. 获取免押二维码
  185. </view>
  186. </view>
  187. <!-- //showbtn -->
  188. <view class="btm-btn flex" v-else
  189. style="text-align: center;color: #fff;background-color: #6cd9c0;justify-content: center;" @click="saveShareQrcode">
  190. 保存二维码
  191. </view>
  192. <uni-popup ref="mypopup" type="center" @change="mychange">
  193. <view class="myj-wrap">
  194. <view class="ewm-wrap">
  195. <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvas" id="myCanvas"
  196. class="hb"></canvas>
  197. </view>
  198. </view>
  199. </uni-popup>
  200. </view>
  201. </template>
  202. <script>
  203. // #ifdef MP-WEIXIN
  204. import {
  205. openMap
  206. } from '@/utils/rocessor.js';
  207. // #endif
  208. // #ifdef H5
  209. import weixinObj from "@/plugin/jweixin-module/index.js";
  210. // #endif
  211. import {
  212. mapState,
  213. mapMutations
  214. } from 'vuex'
  215. import {
  216. storeList,
  217. } from '@/api/product.js';
  218. import {
  219. getUserInfo
  220. } from '@/api/user.js';
  221. import {
  222. orderPay
  223. } from '@/api/order.js'
  224. import {
  225. getRents,
  226. rentCreate,
  227. details
  228. } from '@/api/index.js'
  229. export default {
  230. data() {
  231. return {
  232. showbtn: false,
  233. ewmw: 300, //二维码相对宽度
  234. cw: 600, //画布相对宽度
  235. ch: 600, //画布相对高度
  236. shareQrcodeUrl: '', //画布生成的地址
  237. canvasW: '', //画布宽度
  238. canvasH: '', //画布高度
  239. ewmImg: '', //二维码图片信息
  240. erweimasrc: '', //生成的二维码图片
  241. cid: 'tki-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
  242. size: 300, //生成的二维码大小
  243. unit: 'upx', //大小单位尺寸
  244. // show: true,//默认使用组件中的image标签显示二维码
  245. val: '', //要生成的内容
  246. background: '#ffffff', //二维码背景色
  247. foreground: '#333333', //二维码前景色
  248. pdground: '#333333', //二维码角标色
  249. icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
  250. iconSize: 40, //二维码图标大小
  251. lv: 3, //容错级别
  252. onval: true, //监听val值变化自动重新生成二维码
  253. loadMake: true, //组件初始化完成后自动生成二维码,val需要有值
  254. usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
  255. showLoading: false, //是否显示loading
  256. is_tj: false, //是否使用推荐渠道
  257. couldTj: false, //是否可用推荐渠道
  258. isFj: false, //是否为最近门店
  259. selctStore: {
  260. id: ''
  261. },
  262. now_money: '',
  263. tcList: [],
  264. selectTc: {},
  265. selectTcIndex: 0,
  266. payType: 'yue',
  267. sm: '', //使用说明
  268. loading: false, //是否支付中
  269. }
  270. },
  271. computed: {
  272. ...mapState('user', ['address', 'userInfo'])
  273. },
  274. onLoad() {
  275. this.getRents()
  276. this.getSm()
  277. },
  278. onShow() {
  279. this.userinfo()
  280. if (this.address.latitude == '') {
  281. this.getlocation()
  282. }
  283. },
  284. onReachBottom() {
  285. },
  286. onReady() {
  287. },
  288. methods: {
  289. ...mapMutations('user', ['setUserInfo', 'setAddress']),
  290. //保存图片
  291. saveShareQrcode() {
  292. console.log(this.shareQrcodeUrl)
  293. uni.saveImageToPhotosAlbum({
  294. filePath: this.shareQrcodeUrl,
  295. success: (res) => {
  296. uni.showToast({
  297. icon: 'none',
  298. position: 'bottom',
  299. title: "成功保存到相册",
  300. });
  301. },
  302. fail: (err) => {
  303. //重新提示用户打开保存图片的授权
  304. if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
  305. uni.showModal({
  306. title: '提示',
  307. content: '需要您授权保存相册',
  308. showCancel: false,
  309. success(res) {
  310. if (res.confirm) {
  311. uni.openSetting({
  312. success(settingdata) {
  313. if (settingdata.authSetting[
  314. 'scope.writePhotosAlbum']) {
  315. uni.showModal({
  316. title: '提示',
  317. content: '获取权限成功,再次保存图片即可成功',
  318. showCancel: false,
  319. })
  320. } else {
  321. uni.showModal({
  322. title: '提示',
  323. content: '获取权限失败,无法保存到相册',
  324. showCancel: false
  325. })
  326. }
  327. }
  328. })
  329. }
  330. }
  331. })
  332. }
  333. },
  334. })
  335. },
  336. mychange(e) {
  337. this.showbtn = e.show
  338. },
  339. //获取二维码
  340. getEwm() {
  341. let that = this
  342. setTimeout(() => {
  343. that.val = '阿强是个大傻逼'
  344. this.$refs.mypopup.open()
  345. }, 100)
  346. },
  347. // 获取图片信息
  348. getImageInfo(image) {
  349. return new Promise((req, rej) => {
  350. uni.getImageInfo({
  351. src: image,
  352. success: function(res) {
  353. req(res)
  354. },
  355. });
  356. })
  357. },
  358. // 获取设备信息
  359. getSystemInfo() {
  360. return new Promise((req, rej) => {
  361. uni.getSystemInfo({
  362. success: function(res) {
  363. req(res)
  364. }
  365. });
  366. })
  367. },
  368. async createPoster() {
  369. let that = this
  370. // 获取设备信息,主要获取宽度,赋值给canvasW 也就是宽度:100%
  371. that.SystemInfo = await that.getSystemInfo();
  372. that.ewmImg = await that.getImageInfo(that.erweimasrc);
  373. // this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
  374. that.ratio = that.SystemInfo.windowWidth / 750;
  375. that.canvasW = that.cw * that.ratio;
  376. this.canvasH = that.ch * that.ratio;
  377. that.ewmW = that.ewmw * that.ratio;
  378. // 如果主图,二维码图片,设备信息都获取成功,开始绘制海报,这里需要用setTimeout延时绘制,否则可能会出现图片不显示。
  379. if (that.ewmImg.errMsg == 'getImageInfo:ok' && that.SystemInfo.errMsg == 'getSystemInfo:ok') {
  380. console.log('二维码和屏幕信息加载完成')
  381. // uni.showToast({
  382. // icon: 'loading',
  383. // mask: true,
  384. // duration: 10000,
  385. // title: '二维码生成中',
  386. // });
  387. setTimeout(() => {
  388. var ctx = uni.createCanvasContext('myCanvas', that);
  389. // 填充背景色,白色
  390. ctx.setFillStyle('#fff'); // 默认白色
  391. ctx.fillRect(0, 0, this.canvasW, this.canvasH) // fillRect(x,y,宽度,高度)
  392. // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度)
  393. ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2), 100 * that.ratio,
  394. this.ewmW, this.ewmW) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度,二维码的宽,高)
  395. // 3、绘制商品标题,多余文字自动换行
  396. ctx.setFontSize(16); // setFontSize() 设置字体字号
  397. ctx.setFillStyle('#333'); // setFillStyle() 设置字体颜色
  398. ctx.setTextAlign('center')
  399. ctx.fillText('请使用支付宝扫描上方二维码', this.canvasW / 2, 200 * that.ratio + that.ewmW)
  400. ctx.draw(false, (ret) => { // draw方法 把以上内容画到 canvas 中。
  401. that.fina = true
  402. uni.canvasToTempFilePath({ // 保存canvas为图片
  403. canvasId: 'myCanvas',
  404. quality: 1,
  405. fileType: 'jpg',
  406. complete: function(res) {
  407. // 在H5平台下,tempFilePath 为 base64, // 图片提示跨域 H5保存base64失败,APP端正常输出临时路径
  408. console.log(res)
  409. that.canvasShow = false
  410. that.shareQrcodeUrl = res.tempFilePath
  411. that.$forceUpdate()
  412. setTimeout(function() {
  413. console.log(that.shareQrcodeUrl, that
  414. .canvasShow)
  415. }, 2000)
  416. },
  417. })
  418. });
  419. }, 1500)
  420. } else {
  421. console.log('err')
  422. }
  423. },
  424. qrR(res) {
  425. this.erweimasrc = res
  426. console.log(res, '二维码图片');
  427. this.createPoster()
  428. },
  429. // 获取附近门店
  430. storeList(source) {
  431. let that = this
  432. storeList({
  433. page: 1,
  434. limit: 1,
  435. latitude: that.address.latitude,
  436. longitude: that.address.longitude,
  437. })
  438. .then(({
  439. data
  440. }) => {
  441. // console.log(data, '结果');
  442. if (data && data.list && data.list.length > 0) {
  443. that.selctStore = data.list[0]
  444. if (data.list[0].distance * 1 <= 100) {
  445. that.isFj = true
  446. }
  447. }
  448. })
  449. .catch(e => {
  450. console.log(e);
  451. });
  452. },
  453. // 获取经纬度
  454. getlocation() {
  455. let obj = this;
  456. // #ifdef H5 || APP
  457. uni.getLocation({
  458. type: 'gcj02',
  459. success(e) {
  460. obj.getlocationSetInit(e)
  461. },
  462. fail(e) {
  463. if (e.errCode == 22) {
  464. uni.showModal({
  465. title: '定位开启错误',
  466. content: '请查看是否已经开启定位服务',
  467. showCancel: false,
  468. });
  469. }
  470. console.log(e, 'cw');
  471. }
  472. })
  473. // #endif
  474. // #ifdef MP-WEIXIN
  475. openMap().then((e) => {
  476. console.log("授权");
  477. wx.getLocation({
  478. type: 'gcj02',
  479. success: (e) => {
  480. console.log(e);
  481. // 调用鉴定位置变化事件
  482. this.getlocationSetInit(e)
  483. },
  484. fail() {}
  485. })
  486. })
  487. // #endif
  488. },
  489. // 获取经纬度完毕后回调处理
  490. getlocationSetInit(data) {
  491. const obj = this;
  492. try {
  493. console.log(data, '位置数据');
  494. // 保存当前经纬度
  495. obj.setAddress({
  496. latitude: data.latitude,
  497. longitude: data.longitude
  498. })
  499. this.storeList()
  500. } catch (e) {
  501. console.log(e, 'cww');
  502. this.storeList()
  503. }
  504. },
  505. // 获取使用说明
  506. getSm() {
  507. details({}, 1).then(res => {
  508. this.sm = res.data.content
  509. })
  510. },
  511. navTo(url) {
  512. uni.navigateTo({
  513. url,
  514. fail() {
  515. uni.switchTab({
  516. url
  517. })
  518. }
  519. })
  520. },
  521. userinfo() {
  522. getUserInfo({}).then(({
  523. data
  524. }) => {
  525. this.now_money = data.now_money;
  526. if (data.store_id > 0) {
  527. this.couldTj = true
  528. this.is_tj = true
  529. }
  530. this.setUserInfo(data)
  531. });
  532. },
  533. choosTc(index, item) {
  534. this.selectTcIndex = index
  535. this.selectTc = item
  536. },
  537. getRents() {
  538. getRents().then(res => {
  539. this.tcList = res.data.rent
  540. this.selectTc = this.tcList[0]
  541. })
  542. },
  543. paySuccessTo() {
  544. uni.hideLoading();
  545. this.loading = false
  546. // uni.redirectTo({
  547. // url: '/pages/user_home/money/paySuccess?orderid=' + this.orderId,
  548. // });
  549. uni.redirectTo({
  550. url: '/pages/user_home/myRent'
  551. })
  552. },
  553. toBuy() {
  554. let that = this
  555. if (!that.is_tj && that.selctStore.id == '') {
  556. return that.$api.msg('请选择门店')
  557. }
  558. that.loading = true
  559. rentCreate({
  560. store_id: that.is_tj ? that.userinfo.store_id : that.selctStore.id,
  561. rent_id: that.selectTc.id,
  562. // #ifdef H5
  563. from: 'weixin', //来源
  564. // #endif
  565. // #ifdef MP-WEIXIN
  566. from: 'routine', //来源
  567. // #endif
  568. // #ifdef APP-PLUS
  569. from: 'app', //来源
  570. // #endif
  571. pay_type: that.payType //支付方式
  572. }).then(({
  573. data,
  574. status,
  575. msg
  576. }) => {
  577. if (data.status == 'ORDER_EXIST') {
  578. uni.showModal({
  579. title: '提示',
  580. content: msg,
  581. showCancel: false
  582. });
  583. uni.hideLoading();
  584. that.loading = false;
  585. return;
  586. }
  587. // 保存订单号
  588. that.orderId = data.result.orderId;
  589. // 判断是否为卡券支付
  590. if (that.payType == 'yue') {
  591. console.log('卡券支付', status == 200 && data.status == 'SUCCESS');
  592. that.loading = false
  593. if (status == 200 && data.status == 'SUCCESS') {
  594. that.paySuccessTo();
  595. } else {
  596. that.$api.msg(msg);
  597. }
  598. } else {
  599. // 立即支付
  600. // obj.orderMoneyPay();
  601. let da = data.result.jsConfig;
  602. let paydata = {
  603. nonceStr: da.nonceStr,
  604. package: da.package,
  605. signType: da.signType,
  606. paySign: da.paySign,
  607. success: function(res) {
  608. that.paySuccessTo();
  609. },
  610. fail: () => {
  611. that.loading = false;
  612. }
  613. };
  614. // #ifdef H5
  615. paydata.timestamp = da.timestamp;
  616. weixinObj.chooseWXPay(paydata);
  617. // #endif
  618. // #ifdef MP-WEIXIN
  619. paydata.timeStamp = da.timestamp;
  620. wx.requestPayment(paydata);
  621. // #endif
  622. }
  623. })
  624. },
  625. orderMoneyPay() {
  626. let obj = this;
  627. orderPay({
  628. uni: obj.orderId,
  629. // #ifdef H5
  630. from: 'weixin', //来源
  631. // #endif
  632. // #ifdef MP-WEIXIN
  633. from: 'routine', //来源
  634. // #endif
  635. // #ifdef APP-PLUS
  636. from: 'app', //来源
  637. // #endif
  638. paytype: obj.payType //支付类型 weixin-微信 yue-卡券
  639. })
  640. .then(e => {
  641. // 判断是否微信小程序支付
  642. if (obj.payType == 'weixin') {
  643. // #ifdef H5 || MP
  644. let da = e.data.result.jsConfig;
  645. let data = {
  646. nonceStr: da.nonceStr,
  647. package: da.package,
  648. signType: da.signType,
  649. paySign: da.paySign,
  650. success: function(res) {
  651. obj.paySuccessTo();
  652. },
  653. fail: () => {
  654. uni.navigateTo({
  655. url: '/pages/order/order?state=0'
  656. });
  657. }
  658. };
  659. // #endif
  660. // #ifdef H5
  661. data.timestamp = da.timestamp;
  662. weixinObj.chooseWXPay(data);
  663. // #endif
  664. // #ifdef MP-WEIXIN
  665. data.timeStamp = da.timestamp;
  666. wx.requestPayment(data);
  667. // #endif
  668. // #ifdef APP
  669. console.log(e.data.result.jsConfig, '返回数值');
  670. uni.requestPayment({
  671. provider: 'wxpay',
  672. orderInfo: e.data.result.jsConfig,
  673. success(e) {
  674. obj.paySuccessTo();
  675. },
  676. fail: (e) => {
  677. console.log(e, '支付失败');
  678. uni.navigateTo({
  679. url: '/pages/order/order?state=0'
  680. });
  681. }
  682. })
  683. // #endif
  684. }
  685. // #ifdef APP
  686. if (obj.payType == 'ali') {
  687. uni.requestPayment({
  688. provider: 'alipay',
  689. orderInfo: e.data.result.jsConfig,
  690. success(e) {
  691. obj.paySuccessTo();
  692. },
  693. fail: (e) => {
  694. console.log(e, '支付失败');
  695. uni.navigateTo({
  696. url: '/pages/order/order?state=0'
  697. });
  698. }
  699. })
  700. }
  701. // #endif
  702. uni.hideLoading();
  703. obj.payLoding = false;
  704. })
  705. .catch(e => {
  706. // 支付完成
  707. uni.hideLoading();
  708. obj.payLoding = false;
  709. console.log(e);
  710. });
  711. },
  712. }
  713. }
  714. </script>
  715. <style lang="scss" scoped>
  716. .content {
  717. padding-top: 1rpx;
  718. }
  719. .dy-wrap,
  720. .tc-wrap {
  721. width: 702rpx;
  722. background: #FFFFFF;
  723. border-radius: 15rpx;
  724. // padding: 25rpx 25rpx 45rpx;
  725. margin: 20rpx auto;
  726. }
  727. .contet-list {
  728. flex-wrap: wrap;
  729. justify-content: space-between;
  730. padding: 0 25rpx 45rpx;
  731. .tc {
  732. width: 315rpx;
  733. height: 212rpx;
  734. background: #FFFFFF;
  735. border: 2px solid #E9E9E9;
  736. border-radius: 10rpx;
  737. margin-bottom: 20rpx;
  738. flex-direction: column;
  739. justify-content: center;
  740. // align-items: center;
  741. .tc-time {
  742. font-size: 28rpx;
  743. font-weight: bold;
  744. color: #00001A;
  745. display: flex;
  746. align-items: center;
  747. image {
  748. height: 34rpx;
  749. margin-right: 10rpx;
  750. }
  751. }
  752. .tc-price {
  753. font-size: 55rpx;
  754. font-weight: bold;
  755. color: #52C696;
  756. padding: 4rpx 0;
  757. &::before {
  758. content: '¥';
  759. font-size: 20rpx;
  760. }
  761. text {
  762. font-size: 22rpx;
  763. font-weight: 500;
  764. text-decoration: line-through;
  765. color: #999999;
  766. }
  767. .tc-time-t {
  768. font-size: 28rpx;
  769. font-weight: bold;
  770. color: #00001A;
  771. text-decoration: none;
  772. }
  773. }
  774. .tc-time-price {
  775. font-size: 22rpx;
  776. font-weight: 500;
  777. color: #999999;
  778. text {
  779. font-weight: bold;
  780. }
  781. }
  782. }
  783. .dy {
  784. height: 187rpx;
  785. }
  786. .action {
  787. background: #F3FFFB;
  788. border: 2px solid #5FCCA7;
  789. }
  790. }
  791. .top-wrap {
  792. justify-content: space-between;
  793. padding: 0 25rpx;
  794. font-size: 32rpx;
  795. font-weight: bold;
  796. color: #00001A;
  797. height: 85rpx;
  798. .top-left {}
  799. .top-right {
  800. text {
  801. font-size: 25rpx;
  802. font-weight: 500;
  803. color: #999999;
  804. }
  805. image {
  806. height: 22rpx;
  807. margin-left: 10rpx;
  808. }
  809. }
  810. }
  811. .sysm {
  812. padding: 34rpx;
  813. font-size: 22rpx;
  814. font-weight: 500;
  815. color: #666666;
  816. }
  817. .ts {
  818. height: 200rpx;
  819. }
  820. .btm-btn {
  821. width: 750rpx;
  822. height: 100rpx;
  823. position: fixed;
  824. bottom: 0;
  825. background-color: #fff;
  826. z-index: 999;
  827. .pay-price {
  828. padding-left: 33rpx;
  829. flex-grow: 1;
  830. font-size: 32rpx;
  831. font-weight: 500;
  832. color: #333333;
  833. text {
  834. font-size: 48rpx;
  835. font-weight: 500;
  836. color: #FF6B2E;
  837. &::before {
  838. content: '¥';
  839. font-size: 28rpx;
  840. }
  841. }
  842. }
  843. .pay-btn {
  844. flex-shrink: 0;
  845. width: 287rpx;
  846. height: 98rpx;
  847. background: linear-gradient(-38deg, #6CDBC3, #6DD6B8);
  848. line-height: 100rpx;
  849. text-align: center;
  850. font-size: 34rpx;
  851. font-weight: 500;
  852. color: #FFFFFF;
  853. }
  854. }
  855. .yt-list {
  856. background: #fff;
  857. margin: 0 $page-row-spacing;
  858. margin-top: 30rpx;
  859. border-radius: 20rpx;
  860. }
  861. .yt-list-cell {
  862. display: flex;
  863. align-items: center;
  864. justify-content: space-between;
  865. padding: 10rpx 30rpx 10rpx 40rpx;
  866. line-height: 70rpx;
  867. position: relative;
  868. .checked,
  869. .noChecked {
  870. width: 36rpx;
  871. height: 36rpx;
  872. }
  873. .noChecked {
  874. border: 1px solid $font-color-light;
  875. border-radius: 100rpx;
  876. }
  877. &.cell-hover {
  878. background: #fafafa;
  879. }
  880. &.b-b:after {
  881. left: 30rpx;
  882. }
  883. .cell-icon {
  884. height: 32rpx;
  885. width: 32rpx;
  886. font-size: 22rpx;
  887. color: #fff;
  888. text-align: center;
  889. line-height: 32rpx;
  890. background: #f85e52;
  891. border-radius: 4rpx;
  892. margin-right: 12rpx;
  893. &.hb {
  894. background: #ffaa0e;
  895. }
  896. &.lpk {
  897. background: #3ab54a;
  898. }
  899. }
  900. .cell-more {
  901. align-self: center;
  902. font-size: 24rpx;
  903. color: $font-color-light;
  904. margin-left: 8rpx;
  905. margin-right: -10rpx;
  906. }
  907. .cell-tit {
  908. font-size: 26rpx;
  909. color: $font-color-light;
  910. margin-right: 10rpx;
  911. .orderIcon {
  912. width: 48rpx;
  913. }
  914. }
  915. .cell-tip {
  916. font-size: 26rpx;
  917. color: $font-color-dark;
  918. &.disabled {
  919. color: $font-color-light;
  920. }
  921. &.active {
  922. color: $base-color;
  923. }
  924. &.red {
  925. color: $base-color;
  926. }
  927. }
  928. &.desc-cell {
  929. .cell-tit {
  930. max-width: 90rpx;
  931. }
  932. }
  933. .desc {
  934. text-align: right;
  935. font-size: $font-base;
  936. color: $font-color-light;
  937. }
  938. }
  939. .store-wrap-empty {
  940. text-align: center;
  941. height: 100rpx;
  942. }
  943. .store-wrap {
  944. background-color: #FFFFFF;
  945. margin-bottom: 30rpx;
  946. padding: 30rpx;
  947. border-radius: 20rpx;
  948. .list,
  949. .km {
  950. color: $font-color-light;
  951. font-size: $font-sm;
  952. }
  953. .logo {
  954. height: 200rpx;
  955. width: 200rpx;
  956. border-radius: 20rpx;
  957. }
  958. .title {
  959. font-size: 36rpx;
  960. color: $font-color-dark;
  961. }
  962. .iconR {
  963. height: 24rpx;
  964. }
  965. .iconA {
  966. width: 24rpx;
  967. height: 24rpx;
  968. }
  969. .addressBox {
  970. font-size: 24rpx;
  971. color: $font-color-light;
  972. justify-content: flex-start;
  973. padding: 10rpx 0;
  974. }
  975. .yysj {
  976. display: inline-block;
  977. // width: 239rpx;
  978. padding: 0 10rpx;
  979. height: 32rpx;
  980. background: #ddf8f1;
  981. border-radius: 16rpx 16rpx 16rpx 0rpx;
  982. font-size: 20rpx;
  983. font-weight: bold;
  984. color: #5FCCA7;
  985. text-align: center;
  986. line-height: 32rpx;
  987. margin-top: 10rpx;
  988. }
  989. }
  990. .zfz {
  991. background: #999 !important;
  992. }
  993. .top-tit {
  994. width: 750rpx;
  995. background-color: #fff;
  996. padding: 10rpx;
  997. .tit {
  998. font-size: 28rpx;
  999. background-color: rgba(108, 217, 192, 0.4);
  1000. border-radius: 5rpx;
  1001. padding: 10rpx;
  1002. }
  1003. }
  1004. .myj-wrap {
  1005. width: 600rpx;
  1006. }
  1007. .qrimg {
  1008. position: absolute;
  1009. left: -9999rpx;
  1010. top: -9999rpx;
  1011. }
  1012. .ewm-wrap {
  1013. border-radius: 20rpx;
  1014. overflow: hidden;
  1015. }
  1016. </style>