| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835 |
- <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" v-if="address.insideDeliveryFee && orderType == 2">
- <view>特殊地址跑腿费</view>
- <view class="tosend_header_do_ri">¥{{ address.insideDeliveryFee }}</view>
- </view>
- <view class="tosend_header_do justify-between" v-if="Vipmoney.canReduceFlag=='1'">
- <view>会员立减</view>
- <view class="tosend_header_do_ri">- ¥{{ Vipmoney.reduceAmount }}</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: [
- {
- 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
- // }
- ],
- openWay: 2,
- hintShow: true,
- page: 1,
- limit: 100,
- dataList: {},
- packMoney: 0, //打包费
- totalPrice: 0,
- totalPrice1: 0,
- address: {
- insideDeliveryFee: 0
- }, //地址
- addressId: '',
- parentId: '',
- orderId: '',
- show: false,
- youhui: false, //优惠活动
- coupon: '',
- shopDet: '',
- huodong: '', //选择的活动信息
- Vipmoney:{
- canReduceFlag:'0',
- reduceAmount:0,
- vipReduceDesc:''
- },//会员立减金额
- 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 MP-WEIXIN
- this.XCXIsSelect = this.$queue.getData('XCXIsSelect') ? this.$queue.getData('XCXIsSelect') : '是'
- // #endif
- this.orderId = option.orderId
- this.orderType = option.orderType
- if (option.shopId) {
- this.shopId = option.shopId
- }
- uni.showLoading({
- title: '加载中...',
- mask: true // 是否显示透明蒙层,防止触摸穿透
- })
- //获取店铺信息
- uni.getLocation({
- type: 'gcj02', //返回可以用于uni.openLocation的经纬度
- success: (res) => {
- // console.log(res, '经纬度')
- this.lat = res.latitude
- this.lng = res.longitude
- }
- })
- this.getAddressList()
- // this.getQishou()
- },
- onUnload() {
- // 页面销毁时清除定时器
- if (this.timer) {
- clearInterval(this.timer)
- }
- },
- onShow() {
- this.getvipMoney()
- this.getMsgData()
-
- this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId')
- if (this.addressId) {
- this.getAddressDet(this.addressId)
- }
- this.getShopDet(this.shopId)
- // 设置定时器
- this.timer = setInterval(() => {
- // 定时器执行的操作
- // this.getQishou()
- // console.log('每分钟执行一次');
- // 这里可以放置你需要每分钟执行的代码
- this.getCouponList()
- this.getHuoList()
- }, 60 * 1000) // 60 * 1000 毫秒代表一分钟
- },
- watch: {
- totalPrice1() {
- this.getIntegralRules()
- }
- },
- methods: {
- //获取会员立减金额
- getvipMoney() {
- var shopId =this.shopId
- this.$Request.get(`/app/vip/get-can-reduce/${shopId}`).then((res) => {
- console.log(res, '会员立减')
- if (res.code == 0 && res.data) {
- this.Vipmoney=res.data
- }
- })
- },
- 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) => {
- // console.log(res, '963')
- 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 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
- } else {
- this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2)
- }
- if (this.coupon) {
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0).toFixed(2)
- )
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- }
- if (this.huodong) {
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0).toFixed(2)
- )
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- }if (this.Vipmoney.canReduceFlag=='1') {
- if (this.orderType == 2) {
- this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount: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 + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount: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 + this.address.insideDeliveryFee).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.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount: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 + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount: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 + this.address.insideDeliveryFee).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)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount: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.dabaoMoney = 0
- 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 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
- } else {
- this.totalPrice1 = this.totalPrice + this.dabaoMoney
- }
- let totalMoney = parseFloat(
- this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0) - (this.coupon.money ? this.coupon.money : 0)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)
- ).toFixed(2)
-
- if (totalMoney <= 0) {
- this.totalPrice1 = 0.01
- } else {
- this.totalPrice1 = totalMoney
- }
- 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
- }
- 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()
- this.$queue.showToast('支付成功')
- setTimeout(() => {
- this.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- } else {
- this.isThrottle = true
- this.$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 {
- this.isThrottle = true
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- })
- // #endif
- // #ifdef MP-WEIXIN
- this.$Request.get('/app/new-pay/enable-new-pay').then((res) => {
- console.log(res, '666')
- if (res.code == 0) {
- 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: res.enable ? 1 : 3
- }
- console.log(data)
- if (res.enable) {
- console.log('xin')
- this.newPay(data)
- } else {
- console.log('jiu')
- this.oldPay(data)
- }
- }
- })
- // #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 {
- this.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
- this.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
- }
- },
- newPay(data) {
- this.$Request.get('/app/order/get-pay-param', data).then((res) => {
- console.log(res, '新支付')
- if (res.code == 0) {
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: res.timeStamp,
- nonceStr: res.nonceStr,
- package: res.packageStr,
- signType: res.signType,
- paySign: res.paySign,
- success: (suc) => {
- uni.hideLoading()
- this.$queue.showToast('支付成功')
- setTimeout(() => {
- this.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- },
- fail: (err) => {
- console.log('fail:' + JSON.stringify(err))
- this.isThrottle = true
- uni.setStorageSync('isClear', true)
- uni.showToast({
- title: '支付失败',
- icon: 'none',
- mask: true
- })
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/order/index'
- })
- }, 1500)
- }
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- this.isThrottle = true
- }
- })
- },
- oldPay(data) {
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
- console.log(res, '旧支付')
- // uni.hideLoading();
- 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: (suc) => {
- uni.hideLoading()
- this.$queue.showToast('支付成功')
- setTimeout(() => {
- this.isThrottle = true
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000)
- },
- fail: (err) => {
- console.log('fail:' + JSON.stringify(err))
- this.isThrottle = true
- uni.setStorageSync('isClear', true)
- uni.showToast({
- title: '支付失败',
- icon: 'none',
- mask: true
- })
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/order/index'
- })
- }, 1500)
- }
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- this.isThrottle = true
- }
- })
- },
- 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) {
- if (code == 0) {
- console.log('999999999999')
- this.setPayment(name, order)
- } else {
- uni.hideLoading()
- uni.showToast({
- title: '支付信息有误'
- })
- this.isThrottle = true
- }
- },
- setPayment(name, order) {
- console.log(777777777, name, order)
- uni.requestPayment({
- provider: name,
- orderInfo: order, //微信、支付宝订单数据
- success: (res) => {
- uni.hideLoading()
- uni.showLoading({
- title: '支付成功',
- icon: 'none'
- })
- setTimeout(() => {
- this.isThrottle = true
- uni.navigateBack()
- }, 1000)
- },
- fail: (err) => {
- this.isThrottle = true
- uni.hideLoading()
- },
- complete: () => {
- this.isThrottle = true
- uni.hideLoading()
- }
- })
- },
- // 获取选择的地址
- getAddressDet(e) {
- let data = {
- addressId: e
- }
- this.$Request.get('/app/address/selectAddressById', data).then((res) => {
- console.log(res, 741258)
- if (res.code == 0) {
- this.address = res.data
- if (this.address.insideAddressId) {
- this.getInsideDeliveryFee(this.address.insideAddressId)
- } else {
- this.getInsideDeliveryFee(0)
- }
- if (JSON.stringify(this.address) != '{}') {
- this.getDistance()
- }
- uni.removeStorageSync('addressId')
- }
- })
- },
- // 获取地址列表
- getAddressList() {
- let data = {
- page: 1,
- limit: 100
- }
- this.$Request.get('/app/address/selectAddressList', data).then((res) => {
- if (res.code == 0 && res.data.list.length) {
- this.address = res.data.list[0]
- res.data.list.forEach((ret) => {
- if (ret.addressDefault == 1) {
- this.address = ret
- }
- })
- if (this.address.insideAddressId) {
- this.getInsideDeliveryFee(this.address.insideAddressId)
- } else {
- this.getInsideDeliveryFee(0)
- }
- // console.log(this.address, '我的地址列表460777')
- if (JSON.stringify(this.address) != '{}') {
- this.getDistance()
- }
- }
- })
- },
- getInsideDeliveryFee(insideAddressId) {
- this.$Request.get(`/app/inside-address/${insideAddressId}`).then((res) => {
- // console.log(res, 987456)
- if (res.code == 0) {
- this.address.insideDeliveryFee = res.data.deliveryFee || 0
- }
- })
- },
- goAddress() {
- uni.navigateTo({
- url: '/my/address/index?add=1'
- })
- },
- // 点击调起地图查看位置
- goMap() {
- let lati = parseFloat(this.dataList.shopLat)
- let longi = parseFloat(this.dataList.shopLng)
- uni.authorize({
- scope: 'scope.userLocation',
- success: (res) => {
- uni.openLocation({
- name: this.dataList.shopName,
- latitude: lati,
- longitude: longi,
- success: () => {}
- })
- },
- 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>
|