| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729 |
- <template>
- <view class="pages">
- <!-- 地址 -->
- <view class="text-center text-red" v-if="isTrue && orderType == 2">超出配送距离</view>
- <view class="food">
- <view class="flex bg justify-between padding-lr-xl">
- <view @click="switchTab(2)" :class="orderType == 2 ? 'select' : ''" class="tabBtn" v-if="XCXIsSelect == '是'">
- <view class="title">外卖配送</view>
- <view :class="orderType == 2 ? 'active' : ''"></view>
- </view>
- <view @click="switchTab(1)" :class="orderType == 1 ? 'select' : ''" class="tabBtn">
- <view class="title">到店自取</view>
- <view :class="orderType == 1 ? 'active' : ''"></view>
- </view>
- </view>
- <view v-if="orderType == 1">
- <view class="flex margin-top">
- <u-icon name="map" size="50"></u-icon>
- <!-- <text>商家信息</text> -->
- <view class="flex-sub padding-tb-sm margin-left-sm">
- <view class="text-lg text-bold text-black">
- <text>{{ dataList.shopName }}</text>
- <text class="margin-left-sm" @click="call"><u-icon name="phone" size="40"></u-icon></text>
- </view>
- <view class="text-df margin-top-xs" style="color: #999999" @click="goMap">
- {{ dataList.detailedAddress }}
- </view>
- </view>
- </view>
- </view>
- <view class="" v-if="orderType == 2">
- <view class="goods_address" v-if="JSON.stringify(address) == '{}'" @click="goAddress">
- <view class="address_box">
- <view class="address_name">请选择收货地址</view>
- <view class="address_image margin-left">
- <image src="../../../static/images/index/right.png"></image>
- </view>
- </view>
- </view>
- <view class="flex margin-top" style="" v-else @click="goAddress">
- <u-icon name="map" size="50"></u-icon>
- <view class="flex-sub padding-tb-sm margin-left-sm">
- <view class="text-lg text-bold text-black">
- <text>{{ address.userName }}</text>
- <text class="margin-left-sm">{{ address.userPhone }}</text>
- </view>
- <view class="text-df margin-top-xs" style="color: #999999">{{ address.province }}{{ address.city }}{{ address.district }}{{ address.addressDetail }}</view>
- </view>
- <view class="address_image margin-left">
- <image src="../../../static/images/index/right.png"></image>
- </view>
- </view>
- <!-- 预约送达时间 -->
- <!-- <view class="goods_address" v-if="reservationOpenFlag==1">
- <view class="address_box">
- <view class="address_name">送达时间</view>
- <picker class='time-picker' mode="multiSelector" @change="bindStartMultiPickerChange"
- @columnchange="bindMultiPickerColumnChange" :range="data.multiArray">
- {{data.startDate}}
- </picker>
- <view class="songda_image">
- <image src="../../../static/images/index/right.png"></image>
- </view>
- </view>
- </view> -->
- </view>
- </view>
- <!-- 商品 -->
- <view class="food">
- <view class="tosend_header_food" v-for="(item, index) in dataList.orderGoodsList" :key="index">
- <view class="tosend_header_food_le">
- <image :src="item.goodsPicture[0]" style="border-radius: 10rpx" mode=""></image>
- </view>
- <view class="flex-sub margin-left-sm">
- <view class="flex justify-between align-center">
- <view class="text-lg text-bold text-black">{{ item.goodsName }}</view>
- <view class="text-lg text-bold text-black">
- <text class="text-sm">¥</text>
- {{ item.goodsPrice }}
- </view>
- </view>
- <view class="flex justify-between align-center text-gray">
- <view v-if="item.skuMessage">{{ item.skuMessage }}</view>
- <view>x{{ item.goodsNum }}</view>
- </view>
- <view class="flex justify-between align-center text-gray margin-tb-sm" v-if="item.goodsPack">
- <view>打包费</view>
- <view class="">¥{{ item.goodsPack }} / 份</view>
- </view>
- </view>
- </view>
- <!-- <view class="tosend_header_do do_top" v-if="item.goodsPack>0" >
- <view>打包费</view>
- <view class="tosend_header_do_ri">¥{{item.goodsPack}}</view>
- </view> -->
- <view class="tosend_header_do justify-between" v-if="paotuiMoney > 0 && orderType == 2">
- <view>跑腿费</view>
- <view class="tosend_header_do_ri">¥{{ paotuiMoney }}</view>
- </view>
- <view class="tosend_header_do justify-between do_bot" @click="isShow">
- <view>优惠券</view>
- <view class="tosend_header_do_ri" v-if="coupon">- ¥{{ coupon.money }}</view>
- <view v-else>
- <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
- </view>
- </view>
- <view class="tosend_header_do justify-between do_bot" @click="huodongShow">
- <view>优惠活动</view>
- <view class="tosend_header_do_ri" v-if="huodong">- ¥{{ huodong.discountAmount }}</view>
- <view v-else>
- <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
- </view>
- </view>
- <view class="tosend_header_do justify-between">
- <view class="tosend_header_do_le2">合计</view>
- <view class="tosend_header_do_ri2">
- <text>¥</text>
- {{ totalPrice1 }}
- </view>
- </view>
- </view>
- <!-- 积分介绍 -->
- <view class="food" v-if="isIntegral">
- <view class="food_top">
- <view class="">获取积分</view>
- <view class="">{{ intergral }}</view>
- </view>
- <view class="food_bottom">
- 实付满{{ ruleAmount1 }}元得
- <text class="bottom_text">{{ ruleValue1 }}分</text>
- ,超过{{ ruleMaxAmount }}元部分,每满{{ ruleAmount2 }}元得
- <text class="bottom_text">{{ ruleValue2 }}分</text>
- ;每笔订单上限
- <text class="bottom_text">{{ maxIntegral }}分</text>
- </view>
- </view>
- <!-- 订单备注 -->
- <view class="food">
- <view class="padding-tb-sm text-lg text-bold text-bold text-black">订单备注</view>
- <view class="flex align-center justify-between padding-tb-sm padding-lr" style="background: #f5f5f5; width: 100%">
- <u-input v-model="remark" type="textarea" placeholder="请输入订单备注" height="180" maxlength="200" style="width: 100%"></u-input>
- </view>
- </view>
- <!-- 支付方式 -->
- <view class="margin-top padding-lr radius bg-white" style="width: 94%; margin: 0 auto; border-radius: 18rpx">
- <view class="padding-tb-sm text-lg text-bold text-bold text-black">支付方式</view>
- <view style="height: 100upx" v-for="(item, index) in openLists" :key="index">
- <view class="flex align-center justify-between padding-tb" v-if="item.text != '零钱'">
- <image :src="item.image" style="width: 55rpx; height: 55rpx; border-radius: 50upx"></image>
- <view class="flex-sub text-xl margin-left">{{ item.text }}</view>
- <radio-group name="openWay" style="margin-left: 20upx" @change="selectWay(item)">
- <label class="tui-radio">
- <radio class="red" :checked="openWay === item.id ? true : false" />
- </label>
- </radio-group>
- </view>
- <view class="flex align-center justify-between padding-tb" v-if="item.text === '零钱'">
- <image :src="item.image" style="width: 55rpx; height: 55rpx; border-radius: 50upx"></image>
- <view class="flex-sub text-xl margin-left">
- {{ item.text }}
- <text style="font-size: 30rpx; margin-left: 10rpx" v-if="userMoney && userMoney > 0">(余额:{{ userMoney }})</text>
- <!-- <text v-else style="font-size: 30rpx; margin-left: 10rpx; text-decoration: underline; color: #ea0000" @tap="goCash()">去充值</text> -->
- </view>
- <radio-group name="openWay" style="margin-left: 20upx" @change="selectWay(item)">
- <label class="tui-radio">
- <radio class="red" :checked="openWay === item.id ? true : false" />
- </label>
- </radio-group>
- </view>
- </view>
- </view>
- <view style="height: 120rpx"></view>
- <!-- 结算 -->
- <view class="goorder">
- <view class="goorder_but" :class="isTrue && orderType == 2 ? 'goorder_but_' : ''" @click="toSettlement">立即结算</view>
- </view>
- <u-popup
- v-model="show"
- mode="center"
- :closeable="true"
- close-icon-pos="top-right"
- close-icon="close-circle"
- close-icon-size="50"
- border-radius="20"
- width="80%"
- @close="close"
- >
- <view class="padding bg-gray">
- <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠券</view>
- <scroll-view scroll-y="true" style="height: 600rpx" v-if="couponList.length > 0">
- <view
- class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
- v-for="(item, index) in couponList"
- :key="index"
- @click="selCoupon(item)"
- >
- <view>
- <view>{{ item.couponName }}</view>
- <view>有效期至{{ item.expirationTime }}</view>
- </view>
- <view class="text-sm text-bold">
- ¥
- <text class="text-lg">{{ item.money }}</text>
- </view>
- </view>
- </scroll-view>
- <view v-if="couponList.length == 0" style="height: 100rpx; line-height: 100rpx; text-align: center; font-weight: 700">暂无可用优惠券</view>
- </view>
- </u-popup>
- <!-- 选择优惠活动 -->
- <u-popup
- v-model="youhui"
- mode="center"
- :closeable="true"
- close-icon-pos="top-right"
- close-icon="close-circle"
- close-icon-size="50"
- border-radius="20"
- width="80%"
- @close="closeYouhui()"
- >
- <view class="padding bg-gray">
- <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠活动</view>
- <scroll-view scroll-y="true" style="height: 600rpx" v-if="huoList.length > 0">
- <view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white" v-for="(item, index) in huoList" :key="index" @click="selctHuo(item)">
- <view>
- <view>{{ item.activityTitle }}</view>
- <view>有效期至{{ item.activityEndTime }}</view>
- </view>
- <!-- <view class="text-sm text-bold">
- ¥
- <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
- <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
- <text class="text-lg" v-if="item.activityType=='4'">全场打{{ item.discountAmount }}折</text>
- </view> -->
- </view>
- </scroll-view>
- <view v-if="huoList.length == 0" style="height: 100rpx; line-height: 100rpx; text-align: center; font-weight: 700">暂无可用优惠活动</view>
- </view>
- </u-popup>
- <view class="hintPopul" v-if="shopDet && shopDet.putawayFlag == 1">
- <view class="content_">
- <image src="../../../static/images/index/shop.png" style="width: 200rpx; height: 180rpx"></image>
- <view class="text-xl text-bold">店铺打烊啦</view>
- <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
- <view class="margin-top-xs text-gray margin-bottom">{{ shopDet.businessHours }}-{{ shopDet.lockHours }}</view>
- <view class="Btns" @click="goBack()">知道了</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- /**
- * 获取任意时间
- */
- function getDate(date, AddDayCount = 0) {
- if (!date) {
- date = new Date()
- }
- if (typeof date !== 'object') {
- date = date.replace(/-/g, '/')
- }
- const dd = new Date(date)
- dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
- var a = new Array('日', '一', '二', '三', '四', '五', '六')
- var week = new Date().getDay()
- var week2 = new Date().getDay() + 1
- const y = dd.getFullYear()
- const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
- const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
- const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
- const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
- const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
- return {
- fullDate: y + '-' + m + '-' + d,
- fullDate2: y + '-' + m + '-' + d + ' ' + h + ':' + f + ':' + s,
- fullTime: m + '月' + d + '日',
- year: y,
- month: m,
- date: d,
- day: dd.getDay(),
- sWeek: '周' + a[week],
- eWeek: '周' + a[week2]
- }
- }
- export default {
- data() {
- return {
- userMoney: 0,
- storeCommodityId: 0,
- openLists: [],
- openWay: 2,
- hintShow: true,
- page: 1,
- limit: 100,
- dataList: {},
- packMoney: 0, //打包费
- totalPrice: 0,
- totalPrice1: 0,
- address: {}, //地址
- addressId: '',
- parentId: '',
- orderId: '',
- show: false,
- youhui: false, //优惠活动
- coupon: '',
- shopDet: '',
- huodong: '', //选择的活动信息
- couponList: [],
- huoList: [], //可用活动
- orderType: 2, //1表示到店自取 2表示外卖配送
- paotuiMoney: 0,
- dabaoMoney: 0,
- goodsMoney: 0,
- distance: 0,
- isTrue: false,
- XCXIsSelect: '是',
- remark: '',
- GoodsorderId: '',
- isThrottle: true,
- lng: '',
- lat: '',
- data: {
- multiArray: [],
- warning: '',
- startDate: '请选择'
- },
- workStart: '', //骑手上班时间
- workEnd: '', //骑手下班时间
- yusongTime: '', //骑手预计送达时长
- reservationFlag: 0, //是否预约单 1是、0否
- expectDeliveryTime: '', //预约送达时间
- timer: '', //定时器
- autoSendOrder: 0, //autoSendOrder为1商家自配,0平台配送
- ifPaotui: 0, //是否满减
- reservationOpenFlag: 0, //1预约,0不预约
- shopId: '',
- // 基础实付满多少
- ruleAmount1: 0,
- // 基础实付满多少送的积分
- ruleValue1: 0,
- // 超过多少
- ruleMaxAmount: 0,
- // 第二阶段实付满多少
- ruleAmount2: 0,
- // 第二阶段实付满多少送的积分
- ruleValue2: 0,
- // 每笔订单获取的积分上限
- maxIntegral: 0,
- // 可获得积分
- intergral: 0,
- // 是否显示积分模块
- isIntegral: false
- }
- },
- onLoad(option) {
- // #ifdef APP
- this.openLists = [
- {
- image: '../../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- }
- // {
- // image: '../../../static/images/my/zhifubao.png',
- // text: '支付宝',
- // id: 3
- // },
- // {
- // image: '../../../static/images/my/jinbi.png',
- // text: '零钱',
- // id: 1
- // }
- ]
- // #endif
- // #ifdef MP-WEIXIN
- this.XCXIsSelect = this.$queue.getData('XCXIsSelect') ? this.$queue.getData('XCXIsSelect') : '是'
- this.openLists = [
- {
- image: '../../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- }
- // {
- // image: '../../../static/images/my/jinbi.png',
- // text: '零钱',
- // id: 1
- // }
- ]
- // #endif
- // #ifdef H5
- this.openLists = [
- {
- image: '../../../static/images/my/weixin.png',
- text: '微信',
- id: 2
- }
- // {
- // image: '../../../static/images/my/zhifubao.png',
- // text: '支付宝',
- // id: 3
- // },
- // {
- // image: '../../../static/images/my/jinbi.png',
- // text: '零钱',
- // id: 1
- // }
- ]
- // #endif
- this.orderId = option.orderId
- this.orderType = option.orderType
- if (option.shopId) {
- this.shopId = option.shopId
- }
- uni.showLoading({
- title: '加载中...',
- mask: true // 是否显示透明蒙层,防止触摸穿透
- })
- this.getShopDet(this.shopId)
- // this.getOrderList()
- this.getAddressList()
- // this.getQishou()
- let that = this
- //获取店铺信息
- uni.getLocation({
- type: 'gcj02', //返回可以用于uni.openLocation的经纬度
- success: function (res) {
- console.log(res, '经纬度')
- that.lat = res.latitude
- that.lng = res.longitude
- }
- })
- },
- onUnload() {
- // 页面销毁时清除定时器
- if (this.timer) {
- clearInterval(this.timer)
- }
- },
- onShow() {
- this.getMsgData()
- this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId')
- if (this.addressId) {
- this.getAddressDet(this.addressId)
- }
- // 设置定时器
- this.timer = setInterval(() => {
- // 定时器执行的操作
- // this.getQishou()
- // console.log('每分钟执行一次');
- // 这里可以放置你需要每分钟执行的代码
- this.getCouponList()
- this.getHuoList()
- }, 60 * 1000) // 60 * 1000 毫秒代表一分钟
- },
- watch: {
- totalPrice1() {
- this.getIntegralRules()
- }
- },
- methods: {
- getIntegralRules() {
- let data = {
- money: this.totalPrice1
- }
- this.$Request.get('/app/userintegral/getIntegralByMoney', data).then((res) => {
- console.log(res, '999')
- if (res.code == 0) {
- this.intergral = res.data.intergral
- this.maxIntegral = res.data.maxIntegral
- this.ruleAmount1 = res.data.ruleAmount1
- this.ruleAmount2 = res.data.ruleAmount2
- this.ruleMaxAmount = res.data.ruleMaxAmount
- this.ruleValue1 = res.data.ruleValue1
- this.ruleValue2 = res.data.ruleValue2
- if (res.data.flag == 1) {
- this.isIntegral = true
- } else {
- this.isIntegral = false
- }
- }
- })
- },
- //获取骑手上下班时间
- getQishou() {
- this.$Request.get('/app/tbindent/work-time').then((res) => {
- if (res.code == 0 && res.data) {
- if (this.orderType == 2) {
- if (this.autoSendOrder == 0) {
- //0是平台配
- this.workStart = parseInt(res.data.workingHoursOfRider.substring(0, 2))
- this.workStartMin = parseInt(res.data.workingHoursOfRider.substring(3, 5))
- this.workEnd = parseInt(res.data.workingHoursOfRider.substring(6, 8))
- } else if (this.autoSendOrder == 1) {
- this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
- this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
- this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
- }
- } else if (this.orderType == 1) {
- this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
- this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
- this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
- }
- this.yusongTime = res.data.timeOfRider
- var date = new Date()
- var currentHours = date.getHours()
- var currentMinute = date.getMinutes()
- var temp = []
- // currentHours = 12;
- var temp_time = []
- //如果当前时间大于20点
- var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- if (parseInt(this.yusongTime / 60) == 0) {
- var h1 = 0
- var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- } else {
- var h1 = parseInt(this.yusongTime / 60)
- var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- }
- var acc = currentHours + h1
- var bcc = currentMinute + h2
- var teshu = this.workStart + h1
- if (bcc >= 60) {
- var b = bcc - 60
- var a = acc + 1
- } else {
- var b = bcc
- var a = acc
- }
- var a1 = a + 1
- var s1 = a.toString()
- var s2 = a1.toString()
- var e1 = b.toString()
- var cc = (this.workStartMin + h2).toString()
- if (currentHours >= this.workEnd - h1) {
- // this.$queue.setData({
- // warning:'当前时间段不在服务范围,现在下单,最早将于明早8点上门安装',
- // startDate:'明早 | 8:00-10:00'
- // })
- var time2 = teshu + 1
- uni.showModal({
- title: '提示',
- content: '当前时间段无骑手配送,现在下单,最早将于明日' + teshu + ':00' + '送达',
- success: function (res) {
- if (res.confirm) {
- } else if (res.cancel) {
- }
- }
- })
- // this.data.startDate = '明早 | '+a + ':'+b + '-' + a1 + ':'+b
- temp[0] = ['明天']
- temp[1] = []
- for (let i = teshu; i < this.workEnd - h1; ) {
- var i1 = i + 1
- var ss1 = i.toString()
- var ss2 = i1.toString()
- temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
- i += 1
- }
- } else if (currentHours < this.workStart) {
- // this.$queue.setData({
- // warning:'当前时间段不在服务范围,现在下单,最早将于今早8点上门安装',
- // startDate:'明早 | 8:00-10:00'
- // })
- var time2 = teshu + 1
- uni.showModal({
- title: '提示',
- content: '当前时间段无骑手配送,现在下单,最早将于今日' + teshu + ':00' + '送达',
- success: function (res) {
- if (res.confirm) {
- } else if (res.cancel) {
- }
- }
- })
- temp[0] = ['今天', '明天']
- temp[1] = []
- for (let i = teshu; i < this.workEnd - h1; ) {
- var i1 = i + 1
- var ss1 = i.toString()
- var ss2 = i1.toString()
- temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
- i += 1
- }
- } else {
- // this.$queue.setData({
- // startDate:'尽快送达 | 两小时内'
- // })
- // this.data.startDate = '尽快送达 | 两小时内'
- // this.data.startDate = s1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + s2.padStart(2,0) + ':'+e1.padStart(2,0)
- temp[0] = ['今天', '明天']
- temp[1] = []
- for (let i = a; i < this.workEnd - h1; ) {
- var i1 = i + 1
- var ss1 = i.toString()
- var ss2 = i1.toString()
- temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
- i += 1
- }
- }
- // this.$queue.setData({
- // multiArray:temp,
- // })
- this.data.multiArray = temp
- if (this.data.warning != '') {
- wx.showToast({
- title: this.data.warning,
- icon: 'none',
- duration: 3000
- })
- }
- }
- })
- },
- bindMultiPickerColumnChange: function (e) {
- let c = e.detail.column
- let v = e.detail.value
- var time = []
- var date = new Date()
- console.log(date)
- var date = new Date()
- var currentHours = date.getHours()
- var currentMinute = date.getMinutes()
- var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- if (parseInt(this.yusongTime / 60) == 0) {
- var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- } else {
- var h1 = parseInt(this.yusongTime / 60)
- var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
- }
- var acc = currentHours + h1
- var bcc = currentMinute + h2
- var teshu = this.workStart + h1
- if (bcc >= 60) {
- var b = bcc - 60
- var a = acc + 1
- } else {
- var b = bcc
- var a = acc
- }
- var a1 = a + 1
- var s1 = a.toString()
- var s2 = a1.toString()
- var e1 = b.toString()
- var cc = (this.workStartMin + h2).toString()
- // console.log(this.workStartMin,h2,'kkk')
- var temp = this.data.multiArray
- // currentHours = 12;
- if (c == 0) {
- if (temp[c][v] == '今天') {
- temp[1] = []
- for (let i = a; i < this.workEnd - h1; ) {
- var i1 = i + 1
- var ss1 = i.toString()
- var ss2 = i1.toString()
- temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
- i += 1
- }
- } else {
- temp[1] = []
- for (let i = teshu; i < this.workEnd - h1; ) {
- var i1 = i + 1
- var ss1 = i.toString()
- var ss2 = i1.toString()
- temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
- i += 1
- }
- }
- // this.$queue.setData({
- // multiArray:temp
- // })
- this.data.multiArray = temp
- this.$forceUpdate()
- }
- },
- bindStartMultiPickerChange: function (e) {
- let temp = this.data.multiArray
- // this.$queue.setData({
- // startDate:temp[0][e.detail.value[0]]+' | '+temp[1][e.detail.value[1]]
- // })
- this.data.startDate = temp[0][e.detail.value[0]] + ' | ' + temp[1][e.detail.value[1]]
- if (this.data.startDate) {
- this.reservationFlag = 1
- if (temp[0][e.detail.value[0]] == '今天') {
- var date = getDate(new Date()).fullDate
- this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
- } else if (temp[0][e.detail.value[0]] == '明天') {
- var date = getDate(new Date(), 1).fullDate
- this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
- } else if (temp[0][e.detail.value[0]] == '后天') {
- var date = getDate(new Date(), 2).fullDate
- this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
- }
- }
- },
- goCash() {
- uni.navigateTo({
- url: '/my/wallet/index'
- })
- },
- getMsgData() {
- this.$Request.get('/app/userintegral/findUserMessage').then((res) => {
- if (res.code == 0 && res.data) {
- this.userMoney = res.data.userMoney ? res.data.userMoney : 0
- }
- })
- },
- //获取店铺详情
- getShopDet(shopId) {
- let data = {
- shopId,
- lng: this.lng,
- lat: this.lat
- }
- this.$Request.get('/app/goods/selectGoodsList', data).then((res) => {
- console.log(res, 'data')
- if (res.code == 0 && res.data) {
- this.reservationOpenFlag = res.data.goodsShop.reservationOpenFlag
- this.autoSendOrder = res.data.goodsShop.autoSendOrder
- this.shopDet = res.data.goodsShop
- this.ifPaotui = res.data.goodsShop.enableFullReductionFlag
- this.getOrderList()
- // this.getQishou()
- }
- })
- },
- goBack() {
- uni.navigateBack({})
- },
- isShow() {
- this.show = true
- },
- //选择优惠活动弹框
- huodongShow() {
- this.youhui = true
- },
- getDistance() {
- if (this.address.lng && this.dataList.shopLng) {
- let data = {
- ol: this.address.lng,
- od: this.address.lat,
- dl: this.dataList.shopLng,
- dd: this.dataList.shopLat
- }
- this.$Request.post('/app/tbindent/distance', data).then((res) => {
- if (res.code == 0) {
- this.distance = res.data
- if (this.distance > Number(this.dataList.distributionDistance)) {
- this.isTrue = true
- } else {
- this.isTrue = false
- }
- }
- })
- }
- },
- close() {
- this.show = false
- },
- closeYouhui() {
- this.youhui = false
- },
- switchTab(e) {
- // this.page = 1
- // this.status = ''
- this.coupon = ''
- this.huodong = ''
- this.orderType = e
- // this.current = 0;
- console.log(e)
- if (JSON.stringify(this.address) != '{}') {
- this.getDistance()
- }
- // if (this.orderType == 2) {
- // this.totalPrice1 = this.totalPrice + this.paotuiMoney + this.dabaoMoney
- // } else {
- // this.totalPrice1 = this.totalPrice + this.dabaoMoney
- // }
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- if (this.coupon) {
- let totalMoney = parseFloat(
- this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0) - (this.huodong.discountAmount ? this.huodong.discountAmount : 0).toFixed(2)
- )
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- }
- if (this.huodong) {
- let totalMoney = parseFloat(
- this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0) - (this.huodong.discountAmount ? this.huodong.discountAmount : 0).toFixed(2)
- )
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- }
- },
- // 删除优惠券
- detCoupon() {
- let data = {
- orderId: this.dataList.orderId
- }
- this.$Request.post('/app/order/deleteCouponByOrderId', data).then((res) => {
- if (res.code == 0) {
- }
- })
- },
- // 选择优惠券
- selCoupon(item) {
- this.coupon = item
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- let totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0) - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)).toFixed(2)
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- let data = {
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : ''
- }
- this.$Request.post('/app/order/employCoupon', data).then((res) => {
- if (res.code == 0) {
- this.show = false
- } else {
- this.$queue.showToast(res.msg)
- }
- })
- },
- //选择活动activityId
- selctHuo(item) {
- this.huodong = item
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- let totalMoney = parseFloat(this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)).toFixed(2)
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- this.youhui = false
- },
- // 获取优惠券列表
- getCouponList() {
- console.log(this.totalPrice)
- console.log(this.dataList.packMoney)
- let data = {
- shopId: this.dataList.shopId,
- page: 1,
- limit: 20,
- minMoney:
- this.orderType == 2 ? parseFloat(this.totalPrice * 1).toFixed(2) * 1 + this.paotuiMoney * 1 + this.dabaoMoney * 1 : parseFloat(this.totalPrice * 1).toFixed(2)
- }
- this.$Request.get('/app/coupon/selectUserCouponList', data).then((res) => {
- if (res.code == 0) {
- this.couponList = res.data.list
- if (this.coupon) {
- let activityExists = this.couponList.some((item) => item.couponId === this.coupon.couponId)
- if (!activityExists) {
- this.coupon = ''
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- let totalMoney = parseFloat(
- this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0) - (this.coupon.money ? this.coupon.money : 0)
- ).toFixed(2)
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- uni.showModal({
- title: '提示',
- content: '当前选择的优惠券已过期,请重新选择',
- success: function (res) {
- if (res.confirm) {
- this.coupon = ''
- } else if (res.cancel) {
- this.coupon = ''
- }
- }
- })
- }
- }
- }
- })
- },
- // 优惠活动列表
- getHuoList() {
- let data = {
- orderId: this.dataList.orderId
- }
- this.$Request.get(`/app/activity/suit-activity/${this.dataList.orderId}`, data).then((res) => {
- if (res.code == 0) {
- this.huoList = res.data
- if (this.huodong) {
- // console.log(this.huodong,'有呢')
- let activityExists = this.huoList.some((item) => item.activityId === this.huodong.activityId)
- if (!activityExists) {
- this.huodong = ''
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- let totalMoney = parseFloat(
- this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0) - (this.coupon.money ? this.coupon.money : 0)
- ).toFixed(2)
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- uni.showModal({
- title: '提示',
- content: '当前选择的优惠活动已过期,请重新选择',
- success: function (res) {
- if (res.confirm) {
- this.huodong = ''
- } else if (res.cancel) {
- this.huodong = ''
- }
- }
- })
- }
- }
- // 匹配出最优惠的活动
- if (this.huoList.length) {
- this.huodong = this.huoList.reduce((prev, current) => (prev.discountAmount > current.discountAmount ? prev : current))
- this.selctHuo(this.huodong)
- }
- }
- })
- },
- // 获取订单信息
- getOrderList() {
- this.paotuiMoney = 0
- this.totalPrice1 = 0
- let data = {
- orderId: this.orderId
- }
- this.$Request.get('/app/order/selectBuyGoods', data).then((res) => {
- console.log(res, '666')
- uni.hideLoading()
- if (res.code == 0) {
- this.dataList = res.data
- this.GoodsorderId = res.data.orderId
- // this.getShopDet(res.data.shopId)
- // this.dataList.orderGoodsList[0].goodsPicture = this.dataList.orderGoodsList[0].goodsPicture.split(',')
- // console.log(this.dataList.orderGoodsList)
- if (this.dataList) {
- this.dataList.orderGoodsList.forEach((res) => {
- res.goodsPicture = res.goodsPicture.split(',')
- this.dabaoMoney += res.goodsPack * res.goodsNum
- this.goodsMoney += res.goodsPrice * res.goodsNum
- this.goodsMoney = parseFloat(this.goodsMoney + this.dabaoMoney)
- })
- }
- console.log(this.ifPaotui, 'this.ifPaotui')
- if (this.ifPaotui == 1) {
- this.paotuiMoney = this.dataList.errandMoney
- } else if (this.ifPaotui == 0) {
- // 判断商品金额是否大于最低减免配送费金额
- if (Number(this.goodsMoney) >= Number(this.dataList.exemptMinMoney)) {
- console.log('跑腿费')
- this.paotuiMoney = 0
- } else {
- this.paotuiMoney = this.dataList.errandMoney
- }
- }
- this.totalPrice = res.data.payMoney * 1
- console.log(this.dabaoMoney, '打包')
- console.log(this.paotuiMoney, '跑腿')
- if (this.orderType == 2) {
- this.totalPrice1 = this.totalPrice + this.paotuiMoney + this.dabaoMoney
- } else {
- this.totalPrice1 = this.totalPrice + this.dabaoMoney
- }
- console.log(this.dataList)
- this.getCouponList()
- this.getHuoList()
- this.detCoupon()
- this.getDistance()
- }
- })
- },
- selectWay: function (item) {
- this.openWay = item.id
- },
- takeReark() {
- let datas = {
- orderId: this.GoodsorderId,
- remark: this.remark
- }
- this.$Request.post('/app/order/updateOrdersRemark', datas).then((res) => {
- // uni.hideLoading();
- if (res.code == 0) {
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- })
- },
- // 立即结算
- toSettlement() {
- if (this.isThrottle == false) {
- return
- }
- let that = this
- if (this.isTrue && this.orderType == 2) {
- uni.showToast({
- title: '超出配送范围',
- icon: 'none'
- })
- reutrn
- }
- if (this.orderType == 2 && !this.address.addressId) {
- uni.showToast({
- title: '请选择收货地址',
- icon: 'none'
- })
- return
- }
- if (this.remark) {
- this.takeReark()
- }
- uni.showLoading({
- title: '支付中...',
- mask: true // 是否显示透明蒙层,防止触摸穿透
- })
- this.isThrottle = false
- if (this.openWay == 1) {
- let data = {
- userId: uni.getStorageSync('userId'),
- type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
- activityId: this.huodong ? this.huodong.activityId : '',
- reservationFlag: this.reservationFlag, //是否预约单 1是、0否
- expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType
- }
- this.$Request.post('/app/wxPay/balanceOrder', data).then((res) => {
- if (res.code == 0) {
- uni.hideLoading()
- that.$queue.showToast('支付成功')
- setTimeout(function () {
- that.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- } else {
- that.isThrottle = true
- that.$queue.showToast(res.msg)
- }
- })
- } else if (this.openWay == 2) {
- // #ifdef H5
- let data = {
- userId: uni.getStorageSync('userId'),
- type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
- activityId: this.huodong ? this.huodong.activityId : '',
- reservationFlag: this.reservationFlag, //是否预约单 1是、0否
- expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType,
- type: 2
- }
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- if (res.code == 0) {
- this.callPay(res.data)
- } else {
- that.isThrottle = true
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- })
- // #endif
- // #ifdef MP-WEIXIN
- let data = {
- userId: uni.getStorageSync('userId'),
- type: 4, //支付方式 1表示微信支付、4或5表示支付宝支付
- activityId: this.huodong ? this.huodong.activityId : '',
- reservationFlag: this.reservationFlag, //是否预约单 1是、0否
- expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType,
- type: 3
- }
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- if (res.code == 0) {
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: res.data.timestamp,
- nonceStr: res.data.noncestr,
- package: res.data.package,
- signType: res.data.signType,
- paySign: res.data.sign,
- success: function (suc) {
- uni.hideLoading()
- that.$queue.showToast('支付成功')
- setTimeout(function () {
- that.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- },
- fail: function (err) {
- console.log('fail:' + JSON.stringify(err))
- that.isThrottle = true
- uni.showToast({
- title: '支付失败',
- icon: 'none',
- mask: true
- })
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/order/index'
- })
- }, 1500)
- }
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- that.isThrottle = true
- }
- })
- // #endif
- // #ifdef APP
- let data = {
- type: 1,
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType
- }
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- console.log(res)
- this.showpay = false
- if (res.code == 0) {
- this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data))
- } else {
- that.isThrottle = true
- }
- })
- // #endif
- } else if (this.openWay == 3) {
- // #ifdef H5
- let data = {
- type: 5,
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType
- }
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- this.showpay = false
- that.isThrottle = true
- const div = document.createElement('div')
- div.innerHTML = res.data //此处form就是后台返回接收到的数据
- document.body.appendChild(div)
- document.forms[0].submit()
- })
- // #endif
- // #ifdef APP-PLUS
- let data = {
- type: 4,
- parentId: this.dataList.parentId,
- couponId: this.coupon ? this.coupon.id : '',
- addressId: this.address.addressId ? this.address.addressId : '',
- orderType: this.orderType
- }
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- this.showpay = false
- this.setPayment('alipay', res.data)
- })
- // #endif
- }
- },
- callPay: function (response) {
- if (typeof WeixinJSBridge === 'undefined') {
- if (document.addEventListener) {
- document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false)
- } else if (document.attachEvent) {
- document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response))
- document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response))
- }
- } else {
- this.onBridgeReady(response)
- }
- },
- onBridgeReady: function (response) {
- let that = this
- if (!response.package) {
- return
- }
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest',
- {
- appId: response.appid, //公众号名称,由商户传入
- timeStamp: response.timestamp, //时间戳,自1970年以来的秒数
- nonceStr: response.noncestr, //随机串
- package: response.package,
- signType: response.signType, //微信签名方式:
- paySign: response.sign //微信签名
- },
- function (res) {
- if (res.err_msg === 'get_brand_wcpay_request:ok') {
- // 使用以上方式判断前端返回,微信团队郑重提示:
- //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
- uni.hideLoading()
- uni.showToast({
- title: '支付成功',
- icon: 'success'
- })
- setTimeout(function () {
- that.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- } else {
- that.isThrottle = true
- uni.hideLoading()
- }
- WeixinJSBridge.log(response.err_msg)
- }
- )
- },
- isCheckPay(code, name, order) {
- let that = this
- if (code == 0) {
- console.log('999999999999')
- this.setPayment(name, order)
- } else {
- uni.hideLoading()
- uni.showToast({
- title: '支付信息有误'
- })
- that.isThrottle = true
- }
- },
- setPayment(name, order) {
- console.log(777777777, name, order)
- let that = this
- uni.requestPayment({
- provider: name,
- orderInfo: order, //微信、支付宝订单数据
- success: function (res) {
- uni.hideLoading()
- uni.showLoading({
- title: '支付成功',
- icon: 'none'
- })
- setTimeout(function () {
- that.isThrottle = true
- uni.navigateBack()
- }, 1000)
- },
- fail: function (err) {
- that.isThrottle = true
- uni.hideLoading()
- },
- complete() {
- that.isThrottle = true
- uni.hideLoading()
- }
- })
- },
- // 获取选择的地址
- getAddressDet(e) {
- let data = {
- addressId: e
- }
- this.$Request.get('/app/address/selectAddressById', data).then((res) => {
- if (res.code == 0) {
- this.address = res.data
- if (JSON.stringify(this.address) != '{}') {
- this.getDistance()
- }
- uni.removeStorageSync('addressId')
- }
- })
- },
- // 获取地址列表
- getAddressList() {
- let that = this
- let data = {
- page: 1,
- limit: 100
- }
- that.$Request.get('/app/address/selectAddressList', data).then((res) => {
- if (res.code == 0) {
- that.address = res.data.list[0] ? res.data.list[0] : {}
- res.data.list.forEach((ret) => {
- if (ret.addressDefault == 1) {
- that.address = ret
- }
- })
- console.log(that.address, '我的地址列表460')
- if (JSON.stringify(this.address) != '{}') {
- this.getDistance()
- }
- }
- })
- },
- goAddress() {
- uni.navigateTo({
- url: '/my/address/index?add=1'
- })
- },
- // 点击调起地图查看位置
- goMap() {
- let that = this
- let lati = parseFloat(that.dataList.shopLat)
- let longi = parseFloat(that.dataList.shopLng)
- uni.authorize({
- scope: 'scope.userLocation',
- success(res) {
- uni.openLocation({
- name: that.dataList.shopName,
- latitude: lati,
- longitude: longi,
- success: function () {}
- })
- },
- fail(err) {}
- })
- },
- // 打电话
- call() {
- uni.makePhoneCall({
- phoneNumber: this.dataList.shopPhone
- })
- }
- }
- }
- </script>
- <style scoped>
- .hintPopul {
- width: 100%;
- height: 100vh;
- position: fixed;
- top: 0;
- background: rgba(0, 0, 0, 0.4);
- z-index: 999;
- }
- .content_ {
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- margin: auto;
- text-align: center;
- width: 500rpx;
- height: 400rpx;
- border-radius: 20rpx;
- background-color: #fff;
- padding-top: 120rpx;
- }
- .content_ image {
- position: absolute;
- top: -50rpx;
- left: 0;
- right: 0;
- margin: auto;
- }
- .hintText {
- font-size: 30rpx;
- }
- .Btns {
- width: 460rpx;
- height: 60rpx;
- line-height: 60rpx;
- text-align: center;
- background: #fcd202;
- font-size: 28rpx;
- border: 2rpx solid #fcd202;
- color: #333333;
- border-radius: 50rpx;
- font-weight: 700;
- margin: auto;
- }
- .goods_address {
- width: 94%;
- background: #ffffff;
- height: 120rpx;
- margin: 20rpx auto 0;
- border-radius: 18rpx;
- }
- .address_box {
- width: 90%;
- margin: 0 auto;
- height: 120rpx;
- display: flex;
- line-height: 120rpx;
- }
- .address_name {
- flex: 1;
- font-size: 30rpx;
- }
- .address_image {
- /* flex: 1; */
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- .address_image image {
- width: 15rpx;
- height: 30rpx;
- }
- .songda_image image {
- width: 20rpx;
- height: 30rpx;
- margin-left: 20rpx;
- }
- /* 地址 */
- .address {
- width: 88%;
- margin: 3% auto;
- padding: 3%;
- display: flex;
- background-color: #ffffff;
- border-radius: 18rpx;
- }
- .adderss_le {
- width: 90%;
- line-height: 1.5;
- }
- .adderss_le_text {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- }
- .adderss_le_text2 {
- font-size: 24rpx;
- font-weight: 500;
- color: #999999;
- display: flex;
- }
- .adderss_le_text2 view {
- margin-left: 2%;
- }
- .adderss_le_text2 view:first-child {
- margin-left: 0;
- }
- .adderss_ri {
- width: 10%;
- text-align: right;
- line-height: 3;
- }
- .adderss_ri image {
- width: 18rpx;
- height: 30rpx;
- }
- /* 商品 */
- .food {
- width: 94%;
- margin: 3% auto;
- padding: 3%;
- background-color: #ffffff;
- border-radius: 18rpx;
- }
- .food_top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 32rpx;
- font-weight: bold;
- }
- .food_bottom {
- margin-top: 20rpx;
- color: #666666;
- font-size: 28rpx;
- line-height: 45rpx;
- }
- .bottom_text {
- color: #ea0018;
- }
- .tosend_header_food {
- width: 100%;
- display: flex;
- margin-top: 3%;
- }
- .tosend_header_food_le {
- width: 15%;
- }
- .tosend_header_food_le image {
- width: 110rpx;
- height: 110rpx;
- }
- .tosend_header_food_ce {
- margin: 0 0 0 4%;
- width: 57%;
- }
- .tosend_header_food_ri {
- text-align: right;
- width: 25%;
- }
- .tosend_header_food_text {
- font-size: 34rpx;
- font-weight: 500;
- color: #333333;
- line-height: 1.8;
- }
- .tosend_header_food_text text {
- font-size: 25rpx;
- }
- .tosend_header_food_text2 {
- font-size: 30rpx;
- font-weight: 500;
- color: #999999;
- }
- .do_top {
- padding-top: 3%;
- }
- .do_bot {
- padding-bottom: 3%;
- border-bottom: 2rpx solid #e6e6e6;
- }
- .tosend_header_do {
- width: 100%;
- color: #333333;
- font-size: 30rpx;
- display: flex;
- margin-top: 20rpx;
- line-height: 1.5;
- }
- .tosend_header_do view {
- /* flex: 1; */
- }
- .tosend_header_do_ri {
- text-align: right;
- }
- .tosend_header_do_le2 {
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- padding-top: 1.5%;
- }
- .tosend_header_do_ri2 {
- text-align: right;
- color: #ea0000;
- font-size: 40rpx;
- }
- .tosend_header_do_ri2 text {
- font-size: 30rpx;
- }
- /* 支付 */
- /* .payment_all{
- width: 88%;margin: 3% auto;padding: 3%;background-color: #FFFFFF;
- border-radius: 18rpx;
- }
- .payment{
- width: 100%;display: flex;margin-top: 3%;
- }
- .payment_le{
- width: 13%;
- }
- .payment_le image{
- width: 60rpx;height: 60rpx;
- }
- .payment_ce{
- width: 52%;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;line-height: 60rpx;
- }
- .payment_ri{
- width: 35%;text-align: right;line-height: 60rpx;
- } */
- /* 结算 */
- .goorder {
- width: 100%;
- padding: 2% 3%;
- position: fixed;
- bottom: 0;
- background-color: #ffffff;
- }
- .goorder_but {
- width: 100%;
- line-height: 3.5;
- text-align: center;
- background: #fcd202;
- border-radius: 36rpx;
- font-weight: 700;
- }
- .goorder_but_ {
- opacity: 0.5;
- }
- .bg {
- background-color: #ffffff;
- }
- .tabBtn {
- /* background-color: #f6f6fa; */
- height: 60rpx;
- line-height: 60rpx;
- color: #999999;
- font-size: 38rpx;
- }
- .active {
- /* width: 82rpx; */
- height: 6rpx;
- background: #fcd202;
- /* position: relative;
- top: -20rpx; */
- z-index: 9;
- }
- </style>
|