1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387 |
- <template>
- <view class="content">
- <view class="qrimg">
- <tki-qrcode :cid="cid" ref="qrcode" :val="val" :size="size" :unit="unit" :background="background"
- :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconSize" :lv="lv" :onval="onval"
- :showLoading="showLoading" :loadMake="loadMake" :usingComponents="usingComponents" @result="qrR" />
- <tki-qrcode :cid="ciddk" ref="qrcodet" :val="valdk" :size="size" :unit="unit" :background="background"
- :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconSize" :lv="lv" :onval="onval"
- :showLoading="showLoading" :loadMake="loadMake" :usingComponents="usingComponents" @result="qrRdk" />
- <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvas" id="myCanvas"
- class="hb"></canvas>
- <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvass" id="myCanvass"
- class="hb"></canvas>
- </view>
- <view class="top-tit">
- <view class="tit">
- 为您展示【台州市】地区套餐,其他地域套餐待开放。
- </view>
- </view>
- <!-- 推荐渠道 -->
- <view class="yt-list">
- <view class="top-wrap flex">
- <view class="top-left">
- 推荐渠道
- </view>
- </view>
- <view class="contet-list flex">
- <view class="tc " style="display: flex;text-align: center;" :class="{'action': is_tj}"
- @click="couldTj?istj==true:''">
- 推荐渠道
- </view>
- <view class="tc" style="display: flex;text-align: center;" :class="{'action': !is_tj}">
- {{isFj?'最近门店': '选择门店'}}
- </view>
- </view>
- </view>
- <!-- 门店选择 -->
- <view class="yt-list tc-wrap" @click="navTo('/pages/index/shopTab?select=1')" v-if="!is_tj">
- <view class="top-wrap flex">
- <view class="top-left">
- {{isFj?'最近门店': '选择门店'}}
- </view>
- </view>
- <view class="store-wrap flex" v-if="selctStore && selctStore.id">
- <view class="imgBox">
- <image class="logo" :src="selctStore.image" mode="aspectFit"></image>
- </view>
- <view class="padding-l-20 flex-grow-true">
- <view class="title clamp flex">
- <view class="name">
- {{selctStore.name}}
- </view>
- <view class="km" v-if="selctStore.range">
- {{selctStore.range<1?selctStore.distance+'m':selctStore.range+'km'}}
- </view>
- </view>
- <view class="flex addressBox margin-t-20">
- <image class="iconA margin-r-10" src="../../static/icon/shop.png" mode="">
- </image>
- <text class="clamp">
- {{selctStore.detailed_address}}
- </text>
- </view>
- <view class="addressBox flex">
- <image class="iconA margin-r-10" src="../../static/icon/shopPhone.png" mode="">
- <text class="clamp">
- {{selctStore.phone}}
- </text>
- </view>
- <view class="yysj">
- 营业时间:{{selctStore.day_time}}
- </view>
- </view>
- </view>
- <view class="store-wrap-empty" v-else>
- 选择门店
- </view>
- </view>
- <!-- 套餐 -->
- <view class="tc-wrap">
- <view class="top-wrap flex">
- <view class="top-left">
- 选择套餐
- </view>
- </view>
- <view class="contet-list flex" style="position: relative;" :style="{'height': isShowAll? 'auto': '550rpx'}">
- <view class="flex" v-if="isShowAll == false"
- style="width: 100%; position: absolute;bottom: 0;background-color: #fff;height: 50rpx;left: 0;text-align: center;border-radius: 0 0 20rpx 20rpx;padding: 0 30px;"
- @click="isShowAll = true">
- <view class="">
- </view>
- <view class="">
- 查看更多套餐 <image src="../../static/icon/down1.png" mode="widthFix"
- style="width: 30rpx;margin-left: 10rpx;"></image>
- </view>
- <view class="">
- </view>
- </view>
- <view class="tc flex" v-for="(item,index) in tcList" :class="{'action': selectTcIndex == index}"
- @click="choosTc(index,item)" v-if="item.day == 30 || !userInfo.payRules">
- <view class="tc-tit">
- {{item.title}}
- </view>
- <view class="tc-price">
- {{item.price}}
- <text class="tc-time-t">
- / {{item.day}}天
- </text>
- </view>
- <view class="tc-time-price">
- <text>{{(item.price*1/(item.day*1)).toFixed(2)}}</text>元/天
- </view>
- </view>
- </view>
- </view>
- <view class="dy-wrap" v-if="selectTc.id && userInfo.battery_deposit != 1">
- <view class="top-wrap flex">
- <view class="top-left">
- 押金服务
- </view>
- <!-- <view class="top-right">
- <text>押金规则</text>
- <image src="../../static/icon/next1.png" mode="heightFix"></image>
- </view> -->
- </view>
- <view class="contet-list flex">
- <view class="tc flex dy" :class="{'action': ismy}" @click="ljmy()">
- <view class="tc-time">
- <!-- <image src="../../static/icon/orderAli.png" mode="heightFix"></image> -->
- 信用免押金
- </view>
- <!-- <view class="tc-time-price">
- 微信信用≥550分
- </view>
- <view class="tc-price">
- 77<text>¥88</text>
- </view> -->
- </view>
- <view class="tc flex dy " :class="{'action': !ismy}" @click="qxmy()">
- <view class="tc-time">
- 支付押金
- </view>
- <!-- <view class="tc-time-price">
- 元/天
- </view> -->
- <view class="tc-price">
- {{selectTc.deposit}}
- </view>
- </view>
- </view>
- </view>
- <view class="myj-wrap" v-if="showMyEwm">
- <view class="ewm-wrap">
- <!-- <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvas" id="myCanvas"
- class="hb"></canvas> -->
- <image :src="shareQrcodeUrl" mode="" :style="{ width:cw + 'rpx', height: ch+'rpx',}"></image>
- </view>
- <view class="bcewm" @click="saveShareQrcode('shareQrcodeUrl')">
- 保存二维码
- </view>
- </view>
- <view class="dy-wrap">
- <view class="top-wrap flex">
- <view class="top-left">
- 代扣服务
- </view>
- <!-- <view class="top-right">
- <text>押金规则</text>
- <image src="../../static/icon/next1.png" mode="heightFix"></image>
- </view> -->
- </view>
- <view class="contet-list flex">
- <view class="tc flex dy" :class="{'action': isdk}" @click="ktdk()">
- <view class="tc-time">
- <!-- <image src="../../static/icon/orderAli.png" mode="heightFix"></image> -->
- 周期代扣
- </view>
- <!-- <view class="tc-time-price">
- 微信信用≥550分
- </view>
- <view class="tc-price">
- 77<text>¥88</text>
- </view> -->
- </view>
- <view class="tc flex dy " :class="{'action': !isdk}" @click="qxdk()">
- <view class="tc-time">
- 卡券/微信
- </view>
- <!-- <view class="tc-time-price">
- 元/天
- </view> -->
- <!-- <view class="tc-price">
- {{selectTc.deposit}}
- </view> -->
- </view>
- </view>
- </view>
- <view class="myj-wrap" v-if="showDkEwm">
- <view class="ewm-wrap">
- <!-- <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvass" id="myCanvass"
- class="hb"></canvas> -->
- <image :src="dkQrcodeUrl" mode="" :style="{ width:cw + 'rpx', height: ch+'rpx',}"></image>
- </view>
- <view class="bcewm" @click="saveShareQrcode('dkQrcodeUrl')">
- 保存二维码
- </view>
- </view>
- <view class="dy-wrap">
- <view class="top-wrap flex">
- <view class="top-left">
- 使用说明
- </view>
- </view>
- <view class="sysm" v-html="sm">
- </view>
- </view>
- <view class="yt-list" v-if="!isdk">
- <view class="yt-list-cell b-b" @click="payType='weixin'">
- <view class="cell-tit flex">
- <image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
- <text class="margin-l-10">微信支付</text>
- </view>
- <image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
- mode="widthFix"></image>
- <view v-else class="noChecked"></view>
- </view>
- <!-- #ifdef APP-PLUS -->
- <view class="yt-list-cell b-b" @click="payType='ali'">
- <view class="cell-tit flex">
- <image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
- <text class="margin-l-10">支付宝</text>
- </view>
- <image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
- </image>
- <view v-else class="noChecked"></view>
- </view>
- <!-- #endif -->
- <view class="yt-list-cell b-b" @click="payType='yue'">
- <view class="cell-tit flex">
- <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
- <text class="margin-l-10">卡券({{now_money}})</text>
- </view>
- <image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
- </image>
- <view v-else class="noChecked"></view>
- </view>
- <view class="yt-list-cell b-b" @click="isqxdk= !isqxdk">
- <view class="cell-tit flex">
- <!-- <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image> -->
- <text class="margin-l-10">使用骑行券抵扣(可用骑行券{{userInfo.certificate}})</text>
- </view>
- <image class="checked" v-if="isqxdk" src="../../static/icon/addressIconXz.png" mode="widthFix">
- </image>
- <view v-else class="noChecked"></view>
- </view>
- </view>
- <view class="ts" v-if="!isdk">
- </view>
- <view class="btm-btn flex" v-if="!isdk">
-
- <!-- <view class="pay-price" v-if="!ismy && userInfo.battery_deposit != 1">
- 总计费用:<text>{{(selectTc.price*1 + selectTc.deposit*1).toFixed(2) || ''}}</text>
- </view>
- <view class="pay-price" v-else>
- 总计费用:<text>{{(selectTc.price*1).toFixed(2) || ''}}</text>
- </view> -->
- <view class="pay-price">
- 总计费用:<text>{{showPrice}}</text>
- </view>
- <view class="pay-btn" @click="toBuy('buy')" :class="{'zfz': loading}">
- {{loading?'支付中':'立即支付'}}
- </view>
- </view>
- </view>
- </template>
- <script>
- // #ifdef MP-WEIXIN
- import {
- openMap
- } from '@/utils/rocessor.js';
- // #endif
- // #ifdef H5
- import weixinObj from "@/plugin/jweixin-module/index.js";
- // #endif
- import {
- mapState,
- mapMutations
- } from 'vuex'
- import {
- storeList,
- } from '@/api/product.js';
- import {
- getUserInfo
- } from '@/api/user.js';
- import {
- orderPay
- } from '@/api/order.js'
- import {
- getRents,
- rentCreate,
- details,
- rentFree,
- contractCreate,
- createSignFLow
- } from '@/api/index.js'
- export default {
- data() {
- return {
- isShowDk:true,
- isShowAll: false,
- showTc: [],
- isqxdk: false,
- isdk: false, //是否代扣
- ismy: false, //是否免押
- showbtn: false,
- ewmw: 300, //二维码相对宽度
- cw: 702, //画布相对宽度
- ch: 600, //画布相对高度
- shareQrcodeUrl: '', //画布生成的地址
- dkQrcodeUrl: '',
- canvasW: '', //画布宽度
- canvasH: '', //画布高度
- ewmImg: '', //二维码图片信息
- erweimasrc: '', //生成的二维码图片
- dkerweima: '',
- cid: 'tki-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
- ciddk: 'dk-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
- size: 300, //生成的二维码大小
- unit: 'upx', //大小单位尺寸
- // show: true,//默认使用组件中的image标签显示二维码
- val: '', //要生成的内容
- valdk: '',
- background: '#ffffff', //二维码背景色
- foreground: '#333333', //二维码前景色
- pdground: '#333333', //二维码角标色
- icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
- iconSize: 40, //二维码图标大小
- lv: 3, //容错级别
- onval: true, //监听val值变化自动重新生成二维码
- loadMake: true, //组件初始化完成后自动生成二维码,val需要有值
- usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
- showLoading: false, //是否显示loading
- is_tj: false, //是否使用推荐渠道
- couldTj: false, //是否可用推荐渠道
- isFj: false, //是否为最近门店
- selctStore: {
- id: ''
- },
- now_money: '',
- tcList: [],
- selectTc: {},
- selectTcIndex: 0,
- payType: 'yue',
- sm: '', //使用说明
- loading: false, //是否支付中
- renew: 0, //是否续费
- }
- },
- watch: {
- selctStore(n, o) {
- if (n) {
- console.log(n.is_pledge,'n.is_pledge');
- if(this.userInfo.battery_deposit != 1 && n.is_pledge == 1) {
- this.ljmy()
- }
- if (this.selectTc.day*1 == 30 && !this.userInfo.payRules ) {
- this.ktdk()
- }else {
-
- this.qxdk()
- this.isShowDk = false
-
- }
- }
- },
- selectTc(n,o) {
- console.log('选择套餐');
- if(n) {
- if(this.ismy) {
- this.ljmy()
- }
- if(n.day*1 != 30) {
- this.qxdk()
- this.isShowDk = false
- }else if(!this.userInfo.payRules) {
- this.isShowDk = true
- }
- }
- }
- },
- computed: {
- ...mapState('user', ['address', 'userInfo']),
- //展示免押二维码
- showMyEwm() {
- return this.ismy && this.shareQrcodeUrl
- },
- //展示代扣二维码
- showDkEwm() {
- return this.isdk && this.dkQrcodeUrl
- },
- showPrice() {
- let price;
- // 不免押和没有免押
- if(!this.ismy && this.userInfo.battery_deposit != 1) {
- price = this.selectTc.price * 1 + this.selectTc.deposit * 1
- if(this.isqxdk) {
- let all = (price - this.userInfo.certificate * 1).toFixed(2)
- return all > 0 ? all : 0
- }else {
- return price*1
- }
- }else {
- if (this.isqxdk) {
- let all = (this.selectTc.price * 1 - this.userInfo.certificate * 1).toFixed(2)
- return all > 0 ? all : 0
- } else {
- return this.selectTc.price * 1
- }
- }
- }
- },
- onLoad(opt) {
- if (opt.renew) {
- this.renew = opt.renew
- }
- this.getRents()
- this.getSm()
- },
- onShow() {
- this.userinfo()
- if (this.address.latitude == '') {
- this.getlocation()
- }else {
- this.storeList()
- }
- },
- onReachBottom() {
- },
- onReady() {
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setAddress']),
- //取消免押
- qxdk() {
- this.isdk = false
- },
- qxmy() {
- this.ismy = false
- },
- // 开通代扣
- ktdk() {
- let that = this
- that.dkQrcodeUrl = ''
- if (!that.is_tj && that.selctStore.id == '') {
- return that.$api.msg('请选择门店')
- }
- if(!that.isShowDk) {
- return
- }
- this.isdk = true
- // this.contractCreate()
-
- this.toBuy()
- },
- contractCreate() {
- contractCreate().then(res => {
- // console.log(res);
- })
- },
- createSignFLow() {
- uni.showLoading({
- title: '二维码生成中...'
- })
- createSignFLow().then(res => {
- this.valdk = res.data.result.link
- })
- },
- // 选择免押
- ljmy() {
- let that = this
- if (!that.is_tj && that.selctStore.id == '') {
- return that.$api.msg('请选择门店')
- }
- if(that.selectTc.is_pledge == 0) {
- return
- }
- if(this.shareQrcodeUrl) {
- this.shareQrcodeUrl = ''
- }
- this.ismy = true
- this.rentFree()
- if(this.isdk) {
- this.ktdk()
- }
- },
- rentFree() {
- let that = this
- if (!that.is_tj && that.selctStore.id == '') {
- return that.$api.msg('请选择门店')
- }
- uni.showLoading({
- title: '二维码生成中...'
- })
- rentFree({
- rent_id: that.selectTc.id
- }).then(res => {
- that.val = res.data.result.link
- })
- },
- //保存图片
- saveShareQrcode(img) {
- uni.saveImageToPhotosAlbum({
- filePath: this[img],
- success: (res) => {
- uni.showToast({
- icon: 'none',
- position: 'bottom',
- title: "成功保存到相册",
- });
- },
- fail: (err) => {
- //重新提示用户打开保存图片的授权
- if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
- uni.showModal({
- title: '提示',
- content: '需要您授权保存相册',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- uni.openSetting({
- success(settingdata) {
- if (settingdata.authSetting[
- 'scope.writePhotosAlbum']) {
- uni.showModal({
- title: '提示',
- content: '获取权限成功,再次保存图片即可成功',
- showCancel: false,
- })
- } else {
- uni.showModal({
- title: '提示',
- content: '获取权限失败,无法保存到相册',
- showCancel: false
- })
- }
- }
- })
- }
- }
- })
- }
- },
- })
- },
- mychange(e) {
- this.showbtn = e.show
- },
- //获取二维码
- getEwm() {
- let that = this
- setTimeout(() => {
- that.val = '阿强是个大傻逼'
- this.$refs.mypopup.open()
- }, 100)
- },
- // 获取图片信息
- getImageInfo(image) {
- return new Promise((req, rej) => {
- uni.getImageInfo({
- src: image,
- success: function(res) {
- req(res)
- },
- });
- })
- },
- // 获取设备信息
- getSystemInfo() {
- return new Promise((req, rej) => {
- uni.getSystemInfo({
- success: function(res) {
- req(res)
- }
- });
- })
- },
- async createPoster(imgname, ewmimg, cavid, tit = '') {
- let that = this
- // 获取设备信息,主要获取宽度,赋值给canvasW 也就是宽度:100%
- that.SystemInfo = await that.getSystemInfo();
- that.ewmImg = await that.getImageInfo(ewmimg);
- // this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
- that.ratio = that.SystemInfo.windowWidth / 750;
- that.canvasW = that.cw * that.ratio;
- this.canvasH = that.ch * that.ratio;
- that.ewmW = that.ewmw * that.ratio;
- // 如果主图,二维码图片,设备信息都获取成功,开始绘制海报,这里需要用setTimeout延时绘制,否则可能会出现图片不显示。
- if (that.ewmImg.errMsg == 'getImageInfo:ok' && that.SystemInfo.errMsg == 'getSystemInfo:ok') {
- console.log('二维码和屏幕信息加载完成')
- setTimeout(() => {
- var ctx = uni.createCanvasContext(cavid, that);
- // 填充背景色,白色
- ctx.setFillStyle('#fff'); // 默认白色
- ctx.fillRect(0, 0, this.canvasW, this.canvasH) // fillRect(x,y,宽度,高度)
- // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度)
- ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2), 100 * that.ratio,
- this.ewmW, this.ewmW) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度,二维码的宽,高)
- // 3、绘制商品标题,多余文字自动换行
- ctx.setFontSize(16); // setFontSize() 设置字体字号
- ctx.setFillStyle('#333'); // setFillStyle() 设置字体颜色
- ctx.setTextAlign('center')
- ctx.fillText('请使用支付宝扫描上方二维码', this.canvasW / 2, 200 * that.ratio + that.ewmW)
- ctx.fillText(tit, this.canvasW / 2, 260 * that.ratio + that.ewmW)
- ctx.draw(false, (ret) => { // draw方法 把以上内容画到 canvas 中。
- that.fina = true
- uni.canvasToTempFilePath({ // 保存canvas为图片
- canvasId: cavid,
- quality: 1,
- fileType: 'jpg',
- complete: function(res) {
- // 在H5平台下,tempFilePath 为 base64, // 图片提示跨域 H5保存base64失败,APP端正常输出临时路径
- console.log(res)
- // that.canvasShow = false
- that[imgname] = res.tempFilePath
- that.$forceUpdate()
- uni.hideLoading()
- // setTimeout(function() {
- // console.log(that.shareQrcodeUrl, that
- // .canvasShow)
- // }, 2000)
- },
- })
- });
- }, 1500)
- } else {
- console.log('err')
- }
- },
- qrR(res) {
- this.erweimasrc = res
- this.createPoster('shareQrcodeUrl', this.erweimasrc, 'myCanvas', '完成免押服务')
- },
- qrRdk(res) {
- this.dkerweima = res
- this.createPoster('dkQrcodeUrl', this.dkerweima, 'myCanvass', '完成代扣服务')
- },
- // 获取附近门店
- storeList(source) {
- let that = this
- storeList({
- page: 1,
- limit: 1,
- latitude: that.address.latitude,
- longitude: that.address.longitude,
- })
- .then(({
- data
- }) => {
- // console.log(data, '结果');
- if (data && data.list && data.list.length > 0) {
- that.selctStore = data.list[0]
- // if (data.list[0].distance * 1 <= 100) {
- that.isFj = true
-
- // }
- }
- })
- .catch(e => {
- console.log(e);
- });
- },
- // 获取经纬度
- getlocation() {
- let obj = this;
- // #ifdef H5 || APP
- uni.getLocation({
- type: 'gcj02',
- success(e) {
- obj.getlocationSetInit(e)
- },
- fail(e) {
- if (e.errCode == 22) {
- uni.showModal({
- title: '定位开启错误',
- content: '请查看是否已经开启定位服务',
- showCancel: false,
- });
- }
- console.log(e, 'cw');
- }
- })
- // #endif
- // #ifdef MP-WEIXIN
- openMap().then((e) => {
- console.log("授权");
- wx.getLocation({
- type: 'gcj02',
- success: (e) => {
- console.log(e);
- // 调用鉴定位置变化事件
- this.getlocationSetInit(e)
- },
- fail() {}
- })
- })
- // #endif
- },
- // 获取经纬度完毕后回调处理
- getlocationSetInit(data) {
- const obj = this;
- try {
- console.log(data, '位置数据');
- // 保存当前经纬度
- obj.setAddress({
- latitude: data.latitude,
- longitude: data.longitude
- })
- this.storeList()
- } catch (e) {
- console.log(e, 'cww');
- this.storeList()
- }
- },
- // 获取使用说明
- getSm() {
- details({}, 1).then(res => {
- this.sm = res.data.content
- })
- },
- navTo(url) {
- console.log('navto');
- try{
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- })
- }
- })
- }catch(e){
- console.log(e,'err');
- //TODO handle the exception
- }
-
- },
- userinfo() {
- getUserInfo({}).then(({
- data
- }) => {
- this.now_money = data.now_money;
- if (data.store_id > 0) {
- this.couldTj = true
- this.is_tj = true
- }
- this.setUserInfo(data)
- if (!data.pxz_user_id) {
- this.contractCreate()
- }
- });
- },
- choosTc(index, item) {
- this.selectTcIndex = index
- this.selectTc = item
- if (this.isdk) {
- this.ktdk()
- }
- },
- getRents() {
- let that = this
- getRents({
- store_id: that.is_tj ? that.userInfo.store_id : that.selctStore.id
- }).then(res => {
- that.tcList = res.data.rent
- that.selectTc = that.tcList[0]
- })
- },
- paySuccessTo() {
- uni.hideLoading();
- this.loading = false
- // uni.redirectTo({
- // url: '/pages/user_home/money/paySuccess?orderid=' + this.orderId,
- // });
- uni.redirectTo({
- url: '/pages/user_home/myRent'
- })
- },
- toBuy(flag) {
- let that = this
- if (!that.is_tj && that.selctStore.id == '') {
- return that.$api.msg('请选择门店')
- }
- // uni.showLoading({
- // title:'二维码生成中...'
- // })
- if (!this.isdk) {
- that.loading = true
- }
- rentCreate({
- store_id: that.is_tj ? that.userInfo.store_id : that.selctStore.id,
- rent_id: that.selectTc.id,
- // #ifdef H5
- from: 'weixin', //来源
- // #endif
- // #ifdef MP-WEIXIN
- from: 'routine', //来源
- // #endif
- // #ifdef APP-PLUS
- from: 'app', //来源
- // #endif
- pay_type: that.isdk ? 'pxz' : that.payType, //支付方式
- renew: that.renew,
- is_certificate: that.isdk ? 0 : (that.isqxdk ? 1 : 0)
- }).then(({
- data,
- status,
- msg
- }) => {
- if (that.isdk) {
- this.createSignFLow()
- } else {
- if (data.status == 'ORDER_EXIST') {
- uni.showModal({
- title: '提示',
- content: msg,
- showCancel: false
- });
- uni.hideLoading();
- that.loading = false;
- return;
- }
- // 保存订单号
- that.orderId = data.result.orderId;
- // 判断是否为卡券支付
- if (that.payType == 'yue') {
- console.log('卡券支付', status == 200 && data.status == 'SUCCESS');
- that.loading = false
- if (status == 200 && data.status == 'SUCCESS' ) {
- console.log('判断是否真付款');
- if(!that.isdk) {
- console.log('真付款');
- if(flag == 'buy') {
- that.paySuccessTo();
- }
-
- }else {
- console.log('假付款');
- }
- } else {
- that.$api.msg(msg);
- }
- } else {
- // 立即支付
- // obj.orderMoneyPay();
- if (data.status == 'SUCCESS' && that.payType == 'weixin') {
- that.paySuccessTo();
- } else {
- let da = data.result.jsConfig;
- let paydata = {
- nonceStr: da.nonceStr,
- package: da.package,
- signType: da.signType,
- paySign: da.paySign,
- success: function(res) {
- that.paySuccessTo();
- },
- fail: () => {
- that.loading = false;
- }
- };
- // #ifdef H5
- paydata.timestamp = da.timestamp;
- weixinObj.chooseWXPay(paydata);
- // #endif
- // #ifdef MP-WEIXIN
- paydata.timeStamp = da.timestamp;
- wx.requestPayment(paydata);
- // #endif
- }
- }
- }
- // that.val = data.result.link
- // uni.hideLoading()
- // that.$refs.mypopup.open()
- })
- },
- orderMoneyPay() {
- let obj = this;
- orderPay({
- uni: obj.orderId,
- // #ifdef H5
- from: 'weixin', //来源
- // #endif
- // #ifdef MP-WEIXIN
- from: 'routine', //来源
- // #endif
- // #ifdef APP-PLUS
- from: 'app', //来源
- // #endif
- paytype: obj.payType //支付类型 weixin-微信 yue-卡券
- })
- .then(e => {
- // 判断是否微信小程序支付
- if (obj.payType == 'weixin') {
- // #ifdef H5 || MP
- let da = e.data.result.jsConfig;
- let data = {
- nonceStr: da.nonceStr,
- package: da.package,
- signType: da.signType,
- paySign: da.paySign,
- success: function(res) {
- obj.paySuccessTo();
- },
- fail: () => {
- uni.navigateTo({
- url: '/pages/order/order?state=0'
- });
- }
- };
- // #endif
- // #ifdef H5
- data.timestamp = da.timestamp;
- weixinObj.chooseWXPay(data);
- // #endif
- // #ifdef MP-WEIXIN
- data.timeStamp = da.timestamp;
- wx.requestPayment(data);
- // #endif
- // #ifdef APP
- console.log(e.data.result.jsConfig, '返回数值');
- uni.requestPayment({
- provider: 'wxpay',
- orderInfo: e.data.result.jsConfig,
- success(e) {
- obj.paySuccessTo();
- },
- fail: (e) => {
- console.log(e, '支付失败');
- uni.navigateTo({
- url: '/pages/order/order?state=0'
- });
- }
- })
- // #endif
- }
- // #ifdef APP
- if (obj.payType == 'ali') {
- uni.requestPayment({
- provider: 'alipay',
- orderInfo: e.data.result.jsConfig,
- success(e) {
- obj.paySuccessTo();
- },
- fail: (e) => {
- console.log(e, '支付失败');
- uni.navigateTo({
- url: '/pages/order/order?state=0'
- });
- }
- })
- }
- // #endif
- uni.hideLoading();
- obj.payLoding = false;
- })
- .catch(e => {
- // 支付完成
- uni.hideLoading();
- obj.payLoding = false;
- console.log(e);
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- padding-top: 1rpx;
- }
- .dy-wrap,
- .tc-wrap {
- width: 702rpx;
- background: #FFFFFF;
- border-radius: 15rpx;
- // padding: 25rpx 25rpx 45rpx;
- margin: 20rpx auto;
- }
- .contet-list {
- flex-wrap: wrap;
- justify-content: space-between;
- padding: 0 25rpx 45rpx;
- height: 275rpx;
- overflow: hidden;
-
- .tc {
- width: 315rpx;
- height: 212rpx;
- background: #FFFFFF;
- border: 2px solid #E9E9E9;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- flex-direction: column;
- justify-content: center;
- .tc-tit {
- font-size: 36rpx;
- text-align: center;
-
- }
- // align-items: center;
- .tc-time {
- font-size: 28rpx;
- font-weight: bold;
- color: #00001A;
- display: flex;
- align-items: center;
- image {
- height: 34rpx;
- margin-right: 10rpx;
- }
- }
- .tc-price {
- font-size: 55rpx;
- font-weight: bold;
- color: #52C696;
- padding: 4rpx 0;
- &::before {
- content: '¥';
- font-size: 20rpx;
- }
- text {
- font-size: 22rpx;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .tc-time-t {
- font-size: 28rpx;
- font-weight: bold;
- color: #00001A;
- text-decoration: none;
- }
- }
- .tc-time-price {
- font-size: 22rpx;
- font-weight: 500;
- color: #999999;
- text {
- font-weight: bold;
- }
- }
- }
- .tc-t {
- // width: 630rpx;
- }
- .dy {
- height: 187rpx;
- }
- .action {
- background: #F3FFFB;
- border: 2px solid #5FCCA7;
- }
- }
- .top-wrap {
- justify-content: space-between;
- padding: 0 25rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #00001A;
- height: 85rpx;
- .top-left {}
- .top-right {
- text {
- font-size: 25rpx;
- font-weight: 500;
- color: #999999;
- }
- image {
- height: 22rpx;
- margin-left: 10rpx;
- }
- }
- }
- .sysm {
- padding: 34rpx;
- font-size: 22rpx;
- font-weight: 500;
- color: #666666;
- }
- .ts {
- height: 200rpx;
- }
- .btm-btn {
- width: 750rpx;
- height: 100rpx;
- position: fixed;
- bottom: 0;
- background-color: #fff;
- z-index: 999;
- .pay-price {
- padding-left: 33rpx;
- flex-grow: 1;
- font-size: 32rpx;
- font-weight: 500;
- color: #333333;
- text {
- font-size: 48rpx;
- font-weight: 500;
- color: #FF6B2E;
- &::before {
- content: '¥';
- font-size: 28rpx;
- }
- }
- }
- .pay-btn {
- flex-shrink: 0;
- width: 287rpx;
- height: 98rpx;
- background: linear-gradient(-38deg, #6CDBC3, #6DD6B8);
- line-height: 100rpx;
- text-align: center;
- font-size: 34rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- }
- .yt-list {
- background: #fff;
- margin: 0 $page-row-spacing;
- margin-top: 30rpx;
- border-radius: 20rpx;
- }
- .yt-list-cell {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10rpx 30rpx 10rpx 40rpx;
- line-height: 70rpx;
- position: relative;
- .checked,
- .noChecked {
- width: 36rpx;
- height: 36rpx;
- }
- .noChecked {
- border: 1px solid $font-color-light;
- border-radius: 100rpx;
- }
- &.cell-hover {
- background: #fafafa;
- }
- &.b-b:after {
- left: 30rpx;
- }
- .cell-icon {
- height: 32rpx;
- width: 32rpx;
- font-size: 22rpx;
- color: #fff;
- text-align: center;
- line-height: 32rpx;
- background: #f85e52;
- border-radius: 4rpx;
- margin-right: 12rpx;
- &.hb {
- background: #ffaa0e;
- }
- &.lpk {
- background: #3ab54a;
- }
- }
- .cell-more {
- align-self: center;
- font-size: 24rpx;
- color: $font-color-light;
- margin-left: 8rpx;
- margin-right: -10rpx;
- }
- .cell-tit {
- font-size: 26rpx;
- color: $font-color-light;
- margin-right: 10rpx;
- .orderIcon {
- width: 48rpx;
- }
- }
- .cell-tip {
- font-size: 26rpx;
- color: $font-color-dark;
- &.disabled {
- color: $font-color-light;
- }
- &.active {
- color: $base-color;
- }
- &.red {
- color: $base-color;
- }
- }
- &.desc-cell {
- .cell-tit {
- max-width: 90rpx;
- }
- }
- .desc {
- text-align: right;
- font-size: $font-base;
- color: $font-color-light;
- }
- }
- .store-wrap-empty {
- text-align: center;
- height: 100rpx;
- }
- .store-wrap {
- background-color: #FFFFFF;
- margin-bottom: 30rpx;
- padding: 30rpx;
- border-radius: 20rpx;
- .list,
- .km {
- color: $font-color-light;
- font-size: $font-sm;
- }
- .logo {
- height: 200rpx;
- width: 200rpx;
- border-radius: 20rpx;
- }
- .title {
- font-size: 36rpx;
- color: $font-color-dark;
- }
- .iconR {
- height: 24rpx;
- }
- .iconA {
- width: 24rpx;
- height: 24rpx;
- }
- .addressBox {
- font-size: 24rpx;
- color: $font-color-light;
- justify-content: flex-start;
- padding: 10rpx 0;
- }
- .yysj {
- display: inline-block;
- // width: 239rpx;
- padding: 0 10rpx;
- height: 32rpx;
- background: #ddf8f1;
- border-radius: 16rpx 16rpx 16rpx 0rpx;
- font-size: 20rpx;
- font-weight: bold;
- color: #5FCCA7;
- text-align: center;
- line-height: 32rpx;
- margin-top: 10rpx;
- }
- }
- .zfz {
- background: #999 !important;
- }
- .top-tit {
- width: 750rpx;
- background-color: #fff;
- padding: 10rpx;
- .tit {
- font-size: 28rpx;
- background-color: rgba(108, 217, 192, 0.4);
- border-radius: 5rpx;
- padding: 10rpx;
- }
- }
- .myj-wrap {
- width: 702rpx;
- margin: auto;
- }
- .qrimg {
- position: absolute;
- left: -9999rpx;
- top: -9999rpx;
- }
- .ewm-wrap {
- border-radius: 20rpx;
- overflow: hidden;
- }
- .bcewm {
- background-color: $base-color;
- color: #fff;
- text-align: center;
- height: 80rpx;
- width: 702rpx;
- border-radius: 40rpx;
- margin: auto;
- margin-top: 30rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- // margin-left: 75rpx;
- }
- </style>
|