rent.vue 27 KB

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