| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549 |
- <template>
- <view class="help_pay" style="padding-bottom: 10upx;">
- <view class="part_two">
- <u-tabs :list="list" :is-scroll="false" active-color="#FF7F00" :current="current" @change="tabs">
- </u-tabs>
- <view class="tabs_box" :class="{dis:current == 0}">
- <view class="one_box">
- <view class="box_dian">
- <image src="../static/mai.png"></image>
- </view>
- <view class="box_addres1" style="margin-top: 10upx;">
- <view class="adds">{{AddressRider}}</view>
- </view>
- <view class="box_image">
- <u-icon name="arrow-right" class="icon_you"></u-icon>
- </view>
- </view>
- <view class="box_jh">
- <image src="../static/icon_qh.png"></image>
- </view>
- <!-- 收获地址 -->
- <view class="one_box">
- <view class="box_dian">
- <image src="../static/icon_s.png"></image>
- </view>
- <view class="box_addres" @click="bindclose(1)">
- <view style="text-align: left;" v-if="Object.keys(takeAdd).length>0">
- <view class="add">
- {{takeAdd.province}}{{takeAdd.city}}{{takeAdd.district}}{{takeAdd.addressDetail}}
- </view>
- <view class="num">
- <view class="name">{{takeAdd.userName}}</view>
- <view class="number">{{takeAdd.userPhone}}</view>
- </view>
- </view>
- </view>
- <view class="box_image">
- <u-icon name="arrow-right" class="icon_you"></u-icon>
- </view>
- </view>
- </view>
- <view class="tabs_box" :class="{dis:current == 1}">
- <view class="one_box" @click="bindclose(3)">
- <view class="box_dian">
- <image src="../static/mai.png"></image>
- </view>
- <view class="box_addres" v-if="disinfo">
- <view style="text-align: left;">
- <view class="adds" v-if="disinfo.addressDetail">
- {{disinfo.province}}{{disinfo.city}}{{disinfo.district}}{{disinfo.addressDetail}}
- </view>
- <view class="num" v-if="disinfo.addressDetail">
- <view class="name">{{disinfo.userName}}</view>
- <view class="number">{{disinfo.userPhone}}</view>
- </view>
- <view class="adds text-right text-lg" v-else>请填写取货地址</view>
- </view>
- </view>
- <view class="box_image">
- <u-icon name="arrow-right" class="icon_you"></u-icon>
- </view>
- </view>
- <view class="box_jh">
- <image src="../static/icon_qh.png"></image>
- </view>
- <!-- 收货地址 -->
- <view class="one_box" @click="bindclose(2)">
- <view class="box_dian">
- <image src="../static/icon_s.png"></image>
- </view>
- <view class="box_addres" v-if="Object.keys(takeAdds).length>0">
- <view class="add">
- {{takeAdds.province}}{{takeAdds.city}}{{takeAdds.district}}{{takeAdds.addressDetail}}
- </view>
- <view class="num">
- <view class="name">{{takeAdds.userName}}</view>
- <view class="number">{{takeAdds.userPhone}}</view>
- </view>
- </view>
- <view class="box_addres1 flex-sub text-df text-right" v-else>请填写收货地址</view>
- <view class="box_image">
- <u-icon name="arrow-right" class="icon_you"></u-icon>
- </view>
- </view>
- </view>
- <view style="text-align:right;padding: 10upx;margin-right: 32upx;font-size: 24upx;" v-if="distance">
- 预估跑腿距离:
- <text v-if="distance>1000">{{parseFloat(distance/1000).toFixed(1)}}km</text>
- <text v-else>{{distance}}m</text>
- </view>
- </view>
- <view class="part_one" style="margin-top: 20rpx;">
- <view class="pay_name">请填写帮买商品信息</view>
- <view class="pay_set" style="margin-top: 10upx;">
- <u-input v-model="values" type="textarea" :maxlength="100" placeholder='请填写餐品名称,份数,是否忌口等要求' />
- </view>
- </view>
- <view class="part_three">
- <u-form :model="forms" ref="uForm" label-position="left" :label-style="labelstyle">
- <u-form-item label="时间" right-icon="arrow-right">
- <u-input @click="onshowdata" :clearable="clearable" :disabled="true" v-model="forms.data"
- input-align="right" placeholder="立即购买" />
- </u-form-item>
- <u-form-item label="预付商品费" right-icon="arrow-right">
- <u-input @click="onshowvalua" :type="types" v-model="forms.price" :clearable="clearable"
- input-align="right" placeholder="预估价格" @input="onKeyInput()" />
- </u-form-item>
- <u-form-item label="红包" right-icon="arrow-right">
- <u-input @click="onshowmoney" v-model="forms.hongbao" :disabled="true" :clearable="clearable"
- input-align="right" placeholder="请选择红包" />
- </u-form-item>
- <u-form-item label="小费" right-icon="arrow-right">
- <u-input v-model="forms.tip" type="number" :clearable="clearable" input-align="right"
- placeholder="接单更快 购买更加及时" @input="onKeyInput()" />
- </u-form-item>
- </u-form>
- </view>
- <view class="part_four" style="padding-bottom: 35rpx;">
- <view class="take_number">
- <view class="number_name">收货码</view>
- <view class="number_text">骑手送达时,需提供收货码,确保安全签收</view>
- </view>
- <view class="take_number_kg">
- <u-switch v-model="checked" size="40" active-color="#FF7F00" @change="codekg"></u-switch>
- </view>
- </view>
- <view class="part_four" v-if="price">
- <view class="take_number">
- <view class="number_name">预估跑腿费</view>
- </view>
- <view class="take_number_kg">
- ¥{{price}}
- </view>
- </view>
- <view class="content_sure">
- <u-checkbox-group>
- <u-checkbox v-model="check" shape="circle" active-color="#FF7F00">同意并接受</u-checkbox>
- </u-checkbox-group>
- <view style="font-size: 25rpx;margin-left: -10rpx;" @click="binduserxieyi()">
- 《跑腿代购服务用户协议》
- </view>
- </view>
- <view class="tabbar">
- <!-- <view class="tabbar_price">支付:<text>¥23</text></view> -->
- <view class="tabbar_price">支付:
- <text v-if="!totalprice">¥{{price || 0}}</text>
- <text v-else>¥{{totalprice}}</text>
- </view>
- <view class="tabbar_btn">
- <view class="but" @click="bindpay()">发布并支付</view>
- </view>
- </view>
- <!-- 取件时间弹框 -->
- <u-picker mode="time" v-model="showdata" :default-selector='[0, 0]' cancel-tex="确认" :params="params"
- @confirm="confirm"></u-picker>
- <!-- 红包弹框 -->
- <u-popup v-model="showmoney" mode="bottom" close-icon="close-circle" close-icon-pos="top-right"
- close-icon-color="#8f9298" close-icon-size="50" :closeable="closeable">
- <view class="popup_money">
- <view class="data_title">红包</view>
- <view class="data_select">
- <!-- 红包列表 -->
- <view class="money_box" v-for="(item,index) in hongbao" :key="index"
- v-if="Number(item.redPacketType)==0||Number(item.redPacketType)==indentType">
- <view class="box_tit">
- <view class="money_name">{{item.redPacketTitle}}</view>
- <view class="money_price">¥{{item.redPacketAmount}}</view>
- </view>
- <view class="money_data">有效期至{{item.expirationTime}}</view>
- <view class="money_line">
- <u-line direction="row" color="#E6E6E6" border-style="dashed" />
- </view>
- <view class="box_bottom">
- <view class="money_use">满{{item.minimumAmount}}元可使用</view>
- <view class="money_btn">
- <view class="lj_use" @click="bindhongindex(item.redPacketId,item.redPacketAmount)">
- 立即使用</view>
- <view class="lj_use" @click="bindhongindex(item.redPacketId,item.redPacketAmount)"
- v-if="hongid">
- 已选红包</view>
- </view>
- </view>
- </view>
- <!-- 暂无红包 -->
- <view class="image_box" v-if="hongbao.length==0">
- <image src="../../static/images/empty.png" style="width:100%;height: 350rpx;"></image>
- <view style="width: 100%;text-align: center;color: #ccc;">暂无红包</view>
- </view>
- </view>
- </view>
- </u-popup>
- <u-popup v-model="showpay" mode="bottom" close-icon="close-circle" close-icon-pos="top-right"
- close-icon-color="#8f9298" close-icon-size="50">
- <view class="popup_pay">
- <view class="bg margin-top padding-lr radius">
- <view style="padding: 0 20upx;margin-top: 36rpx;">
- <view
- style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
- v-for="(item,index) in openLists" :key='index'>
- <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
- </image>
- <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
- {{item.text}}
- </view>
- <radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
- <label class="tui-radio">
- <radio color="#FF7F00" :checked="openWay === item.id ? true : false" />
- </label>
- </radio-group>
- </view>
- </view>
- </view>
- <view class="pay_btn" @click="pay()">确认支付</view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- openWay: 0,
- values: '',
- list: [{
- name: '骑手就近购买'
- }, {
- name: '指定购买地址'
- }],
- current: 0,
- checked: true,
- check: false,
- mobile: '',
- code: '',
- AddressRider: '骑手将在您附近3公里内购买',
- forms: {
- data: '立即购买',
- price: '',
- hongbao: '',
- tip: ''
- },
- clearable: false,
- showdata: false,
- showvalua: false,
- showmoney: false,
- showpay: false,
- value: '',
- type: 'text',
- types: 'number',
- border: true,
- params: {
- // year: true,
- // month: true,
- day: true,
- hour: true,
- minute: true,
- timestamp: true
- },
- takeAdd: {},
- takeAdds: {},
- disinfo: [],
- indentType: '3',
- price: 0,
- hongbao: '',
- redPacketId: '',
- helppay: '',
- distance: 3000,
- year: '',
- shipAddressDetail: '',
- buyTime: '',
- closeable: true,
- labelstyle: {
- whiteSpace: 'nowrap',
- fontWeight: 'bold',
- textIndent: '20rpx',
- },
- indentNumber: '',
- openLists: [],
- data: [],
- openWay: '',
- totalprice: '',
- itemCodeFlag: 0,
- hongid: false,
- addressId: '',
- xitongMoney: '', //三公里最低费用
- addressType: ''
- }
- },
- onLoad() {
- // #ifdef H5
- let ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('micromessenger') !== -1) {
- this.openLists = [{
- image: '../static/icon_weixin.png',
- text: '微信',
- id: 2
- }];
- this.openWay = 2;
- } else {
- this.openLists = [{
- image: '../static/zhifubao.png',
- text: '支付宝',
- id: 1
- }];
- this.openWay = 1;
- }
- // #endif
- // #ifdef APP-PLUS
- this.openLists = [{
- image: '../static/zhifubao.png',
- text: '支付宝',
- id: 1
- }, {
- image: '../static/icon_weixin.png',
- text: '微信',
- id: 2
- }];
- this.openWay = 1;
- // #endif
- // #ifdef MP-WEIXIN
- this.openLists = [{
- image: '../static/icon_weixin.png',
- text: '微信',
- id: 2
- }];
- this.openWay = 2;
- // #endif
-
- //帮我买订单最低金额
- this.$Request.get('/app/common/type/280').then(res => {
- if (res.code == 0) {
- this.xitongMoney = res.data.value
- this.price = res.data.value
-
-
- }
- });
- },
- onShow() {
- console.log(this.addressId, '选择的地址id')
- console.log(this.addressType, '选择的地址type')
- this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId')
- this.addressType = this.addressType ? this.addressType : uni.getStorageSync('addressType')
- if (this.addressId) {
- this.getAddress(this.addressId)
- // uni.removeStorageSync('addressType')
- // uni.removeStorageSync('addressId')
- }
- console.log(this.current, '默认地址')
-
- },
- methods: {
- // 跳转地址
- bindclose(index) {
- this.addressType = index;
- // uni.navigateTo({
- // url: '/pages/closeaddress/closeaddress?addressType=' + index
- // })
- uni.navigateTo({
- url: '/my/address/index?add=1&addressType=' + index
- })
- },
- // 查询地址
- getAddress(e) {
- let data = {
- addressId: e
- }
- this.$Request.getT('/app/address/selectAddressById', data).then(res => {
- if (res.code == 0) {
- if (this.addressType == 1) {
- this.distance = 0
- this.takeAdd = res.data
- } else if (this.addressType == 2) {
- this.takeAdds = res.data
- } else if (this.addressType == 3) {
- this.disinfo = res.data
- }
- if (Object.keys(this.disinfo).length && Object.keys(this.takeAdds).length) {
- this.binddistance()
- }
- uni.removeStorageSync('addressId')
- }
- });
- },
- // 距离计算
- binddistance() {
- // this.disinfo = uni.getStorageSync('disinfo')[0]
- let ol = ''
- let od = ''
- let dl = ''
- let dd = ''
- if (this.current == 0) {
- ol = this.takeAdd.lng
- od = this.takeAdd.lat
- dl = this.takeAdd.lng
- dd = this.takeAdd.lat
- } else if (this.current == 1) {
- console.log(this.disinfo[0], 'jjjjjjjj')
- ol = this.disinfo.lng
- od = this.disinfo.lat
- dl = this.takeAdds.lng
- dd = this.takeAdds.lat
- }
- console.log('取货纬度:' + ol, '取货经度:' + od, '送货纬度:' + dl, '送货经度:' + dd)
- this.$Request.postT('/app/tbindent/distance?ol=' + ol + '&od=' + od + '&dl=' + dl + '&dd=' + dd).then(
- res => {
- if (res.code === 0) {
- //通过经纬度计算的距离
- this.distance = res.data
- // console.log(this.distance)
- // 计算跑腿费用
- this.orderjc()
- }
- });
- },
- // 开关
- codekg(e) {
- console.log(e)
- if (e == true) {
- this.itemCodeFlag = 0
- } else if (e == false) {
- this.itemCodeFlag = 1
- }
- },
- // 跑腿用户协议
- binduserxieyi() {
- uni.navigateTo({
- url: '/my/setting/xieyi'
- })
- },
- tabs(index) {
- // console.log(this.current)
- if (this.current == 0) {
- if (this.form && this.form.payaddress1) {
- this.shipAddressDetail = this.form.payaddress1
- }
- this.distance = 0
- this.price = 0
- } else if (this.current == 1) {
- if (uni.getStorageSync('disinfo')) {
- this.shipAddressDetail = uni.getStorageSync('disinfo')[0].detailaddress
- }
- this.distance = 3000
- this.price = this.xitongMoney
- }
- this.current = index;
- },
- // switch打开或者关闭时触发,值为true或者false
- // 即使不监听此事件,this.checked此时也会相应的变成true或者false
- change(status) {
- // console.log(status);
- },
- bindtake(index) {
- let that = this
- uni.chooseLocation({
- success: function(res) {
- console.log(res)
- let disinfo = [{
- addressLatitude: res.latitude,
- addressLongitude: res.longitude,
- address: res.address,
- shipAddressDetail: res.name
- }]
- uni.setStorageSync('disinfo', disinfo)
- that.disinfo = uni.getStorageSync('disinfo')[0]
- }
- });
- },
- confirm(e) {
- console.log(e.timestamp)
- let curDate = new Date();
- this.year = curDate.getFullYear();
- this.month = curDate.getMonth();
- console.log(e.timestamp * 1000)
- console.log(curDate)
- if (parseInt(curDate) >= parseInt(e.timestamp * 1000)) {
- uni.showToast({
- title: '请选择正确时间',
- icon: 'none'
- })
- } else {
- // this.selTime = e.timestamp
- this.buyTime = this.year + '-' + this.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
- this.forms.data = e.day + '日' + e.hour + ':' + e.minute
- }
- },
- onshowdata() {
- this.showdata = true
- },
- binddata() {
- this.showdata = false
- },
- onshowvalua() {
- this.showvalua = true
- },
- bindvalua() {
- this.showvalua = false
- },
- // 根据订单信息判断用户可用红包
- onshowmoney() {
- this.showmoney = true
- let data = {
- indentType: this.indentType, //订单类型
- indentBasicsMoney: this.price
- }
- this.$Request.postJson('/app/tbindent/findRedPacket', data).then(res => {
- // console.log(res)
- if (res.code === 0) {
- this.hongbao = res.data
- // console.log(this.hongbao)
- }
- });
- },
- // 判断红包使用id
- bindhongindex(id, price) {
- console.log(id)
- this.hongid = false
- this.redPacketId = id
- this.forms.hongbao = price
- this.showmoney = false
- let price1 = (Number(this.price) - Number(this.forms.hongbao)).toFixed(2)
- if (price1 <= 0) {
- price1 = 0.01
- }
- this.totalprice = (Number(price1) + Number(this.forms.price) + Number(this.forms.tip)).toFixed(2)
- if (this.totalprice <= 0) {
- this.totalprice = 0.01
- }
- },
- // 计算订单基础价格
- orderjc() {
- let data = {
- indentType: this.indentType, //订单类型
- distance: this.distance, //距离
- }
- this.$Request.postJson('/app/tbindent/basicsMoney', data).then(res => {
- // console.log(res)
- if (res.code === 0) {
- //计算好的跑腿费用
- this.price = res.data.indentBasicsMoney
- this.helppay = res.data
- this.onKeyInput();
- // console.log(this.wpprice)
- }
- });
- },
- // 价格计算
- onKeyInput(e) {
- console.log(e)
- let price = Number(this.price) - Number(this.forms.hongbao)
- if (price <= 0) {
- price = 0.01
- }
- this.totalprice = (Number(price) + Number(this.forms.price) + Number(this.forms.tip)).toFixed(2)
- },
- // 提交订单
- bindpay() {
- // if (!this.indentNumber) {
- // this.totalprice = (Number(this.price) + Number(this.forms.price) - Number(this.forms.hongbao) + Number(this.forms.tip)).toFixed(2)
- // }
- console.log(this.totalprice)
- if (!this.takeAdd && this.current == 0) {
- uni.showToast({
- title: '请填写收货地址',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- console.log(this.disinfo)
- console.log(this.current)
- if (!this.disinfo && this.current == 1) {
- uni.showToast({
- title: '请选择购买地址',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- if (!this.takeAdds && this.current == 1) {
- uni.showToast({
- title: '请填写收货地址',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- if (this.values == '') {
- uni.showToast({
- title: '请填写帮买商品',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- if (this.check == false) {
- uni.showToast({
- title: '请勾选跑腿协议',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- if (this.current == 0) {
- let data = {
- indentType: this.indentType, //订单类型
- productDetails: this.values,
- buyType: this.current,
- shopAddressDetail: this.AddressRider,
- userName: this.takeAdd.userName, //收货人姓名
- userPhone: this.takeAdd.userPhone, //收货人电话
- userProvince: this.takeAdd.province, //收货人 省
- userCity: this.takeAdd.city, //收货人 市
- userDistrict: this.takeAdd.district, //收货人 区
- userAddressDetail: this.takeAdd.addressDetail, //收货人详细地址
- userLng: this.takeAdd.lng,
- userLat: this.takeAdd.lat,
- sendOutTime: this.forms.data,
- // prepayMoney: this.price, //商品价格
- tip: this.forms.tip, //小费
- prepayMoney: this.forms.price,
- itemCodeFlag: this.itemCodeFlag,
- // "itemCode": "收货码",
- // "modeOfPayment": "",
- distance: this.distance, //距离(米)
- redPacketId: this.redPacketId, //红包id,
- indentBasicsMoney: this.indentBasicsMoney,
- userFine: this.helppay.userFine,
- riderFine: this.helppay.riderFine,
- errandMoney: this.helppay.errandMoney
- }
- this.$Request.postJson('/app/tbindent/addIndent', data).then(res => {
- // console.log(res)
- if (res.code == 0) {
- this.indentNumber = res.data.indentNumber
- // #ifdef MP-WEIXIN
- this.openWay = 2
- this.pay()
- // #endif
- // #ifndef MP-WEIXIN
- this.showpay = true
- // #endif
- }
- });
- }
- if (this.current == 1) {
- console.error(JSON.stringify(this.takeAdds))
- let data = {
- indentType: this.indentType, //订单类型
- productDetails: this.values,
- buyType: this.current,
- shopName: this.disinfo.userName, //发货人姓名
- shopPhone: this.disinfo.userPhone, //发货人电话
- shopProvince: this.disinfo.province, //发货人 省
- shopCity: this.disinfo.city, //发货人 市
- shopDistrict: this.disinfo.district, //发货人 区
- shopAddressDetail: this.disinfo.addressDetail, //发货人详细地址
- shopLng: this.disinfo.lng,
- shopLat: this.disinfo.lat,
- userName: this.takeAdds.userName, //收货人姓名
- userPhone: this.takeAdds.userPhone, //收货人电话
- userProvince: this.takeAdds.province, //收货人 省
- userCity: this.takeAdds.city, //收货人 市
- userDistrict: this.takeAdds.district, //收货人 区
- userAddressDetail: this.takeAdds.addressDetail, //收货人详细地址
- userLng: this.takeAdds.lng,
- userLat: this.takeAdds.lat,
- //收货人信息
- deliveryUserPhone: this.takeAdds.userPhone,
- deliveryUserName: this.takeAdds.userName,
- deliveryAddress: this.takeAdds.address,
- deilveryAddressDetail: this.takeAdds.addressDetail,
- deliveryAddressLatitude: this.takeAdds.addressLongitude,
- deliveryAddressLongitude: this.takeAdds.addressLatitude,
- //取货地址
- shipAddressDetail: this.disinfo.shipAddressDetail,
- shipAddressLatitude: this.disinfo.addressLatitude,
- shipAddressLongitude: this.disinfo.addressLongitude,
- shipAddress: this.disinfo.address,
- // shipUserName: this.disinfo.shipUserName,
- // shipUserPhone:this.disinfo.shipUserPhone,
- sendOutTime: this.forms.data,
- // prepayMoney: this.price, //商品价格
- tip: this.forms.tip, //小费
- prepayMoney: this.forms.price,
- itemCodeFlag: this.itemCodeFlag,
- // "itemCode": "收货码",
- // "modeOfPayment": "",
- distance: this.distance, //距离(米)
- redPacketId: this.redPacketId, //红包id,
- indentBasicsMoney: this.indentBasicsMoney,
- userFine: this.helppay.userFine,
- riderFine: this.helppay.riderFine,
- errandMoney: this.helppay.errandMoney
- }
- // console.log(data)
- this.$Request.postJson('/app/tbindent/addIndent', data).then(res => {
- // console.log(res)
- if (res.code == 0) {
- this.indentNumber = res.data.indentNumber
- this.showpay = true
- }
- });
- return;
- }
- },
- selectWay: function(item) {
- this.openWay = item.id;
- },
- pay() {
- // let indentNumber = this.indentNumber
- // console.log(data)
- if (this.openWay == 0) {
- this.$queue.showToast('请选择支付方式!')
- return;
- }
- if (this.openWay == 2) {
- // #ifdef MP-WEIXIN
- // 微信小程序支付
- this.$Request.postJson("/app/wxErrPay/wxPayJsApiOrder?indentNumber=" + this.indentNumber).then(res => {
- console.log(res, '********')
- uni.showLoading({
- title: '支付中...'
- });
- if (res.code == 0) {
- console.log(this.openWay, '支付')
- 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) {
- console.log('success:' + JSON.stringify(suc));
- uni.showToast({
- title: '支付成功',
- icon: 'success'
- })
- uni.setStorageSync('current', 0)
- setTimeout(function() {
- uni.switchTab({
- url: '/pages/order/index',
- })
- }, 10)
- },
- fail: function(err) {
- console.log('fail:' + JSON.stringify(err));
- uni.showToast({
- title: '支付失败',
- icon: 'none'
- })
- uni.switchTab({
- url: '/pages/order/index'
- })
- }
- });
- }
- })
- // #endif
- // #ifdef H5
- let ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('micromessenger') !== -1) { //微信里打开
- this.$Request.postJson('/app/wxPay/wxPayMpOrder?indentNumber=' + this.indentNumber)
- .then(res => {
- console.log(res)
- if (res.code == 0) {
- console.log()
- this.callPay(res.data);
- } else {
- uni.showToast({
- icon: 'none',
- title: '支付失败!'
- });
- }
- });
- } else { //不是微信打开
- this.$Request.postJson('/app/wxPay/wxPayMpOrder?indentNumber=' + this.indentNumber)
- .then(
- res => {
- if (res.code == 0) {
- console.log('....11111111.....', res.data)
- const div = document.createElement('div')
- div.innerHTML = res.data //此处form就是后台返回接收到的数据
- console.log('....2.....', res.data)
- document.body.appendChild(div)
- console.log('....33333.....', document.forms[0])
- document.forms[0].submit()
- } else {
- uni.showToast({
- icon: 'none',
- title: '支付失败!'
- });
- }
- });
- }
- // #endif
- // #ifdef APP-PLUS
- // 微信APP支付 根据订单id获取支付信息
- this.$Request.postT("/app/wxPay/payAppOrder", {
- indentNumber: this.indentNumber
- }).then(ret => {
- console.log(JSON.stringify(ret))
- this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data));
- });
- // #endif
- } else {
-
- // #ifdef H5
- this.$Request.postJson('/app/aliPay/payH5Order?indentNumber=' + this.indentNumber).then(
- res => {
- if (res.code == 0) {
- const div = document.createElement('div')
- div.innerHTML = res.data //此处form就是后台返回接收到的数据
- document.body.appendChild(div)
- document.forms[0].submit()
- } else {
- uni.showToast({
- icon: 'none',
- title: '支付失败!'
- });
- }
- });
- // #endif
- // #ifdef APP
- // APP支付宝支付
- this.$Request.postJson("/app/aliPay/payAppOrder?indentNumber=" + this.indentNumber).then(ret => {
- console.log(ret)
- this.isCheckPay(ret.code, 'alipay', ret.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) {
- console.log(res, '/*-/*-/*-')
- if (res.err_msg === "get_brand_wcpay_request:ok") {
- // 使用以上方式判断前端返回,微信团队郑重提示:
- //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
- uni.showLoading({
- title: '支付成功'
- });
- setTimeout(function() {
- uni.hideLoading();
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 1000);
- } else {
- uni.hideLoading();
- }
- WeixinJSBridge.log(response.err_msg);
- }
- );
- },
- isCheckPay(code, name, order) {
- if (code == 0) {
- this.setPayment(name, order);
- } else {
- uni.hideLoading();
- uni.showToast({
- title: '支付信息有误',
- icon: 'none'
- });
- }
- },
- setPayment(name, order) {
- console.log(name,'*-*-*',order)
- uni.requestPayment({
- provider: name,
- orderInfo: order, //微信、支付宝订单数据
- success: function(res) {
- console.log(res)
- uni.hideLoading();
- uni.showLoading({
- title: '支付成功'
- });
- setTimeout(function() {
- uni.switchTab({
- url: '/pages/order/index',
- })
- }, 1000);
- },
- fail: function(err) {
- console.log(err)
- uni.hideLoading();
- },
- complete() {
- uni.hideLoading();
- }
- });
- },
- }
- }
- </script>
- <style>
- body {
- background: #F2EDED;
- }
- /* #ifndef MP-WEIXIN */
- page {
- background: #F2EDED;
- }
- /* #endif */
- /* 取件时间弹框 */
- .popup_data {
- height: 600upx;
- width: 100%;
- position: relative;
- }
- .data_title {
- width: 92%;
- margin: 0 auto;
- font-size: 32upx;
- line-height: 105upx;
- font-weight: bold;
- letter-spacing: 2upx;
- position: relative;
- top: 0upx;
- z-index: 99991;
- }
- .data_btn {
- position: absolute;
- bottom: 28upx;
- width: 100%;
- z-index: 99992;
- }
- .btn {
- width: 90%;
- margin: 0 auto;
- height: 98upx;
- color: white;
- background: #FF7F00;
- border-radius: 20upx;
- text-align: center;
- line-height: 98upx;
- letter-spacing: 1upx;
- }
- .u-close {
- position: absolute;
- z-index: 999999 !important;
- }
- .u-picker-body {
- height: 700upx !important;
- }
- /* .u-picker-header {
- position: relative !important;
- top: 138upx;
- z-index: 99992;
- } */
- /* 物品信息弹框 */
- .popup_info {
- height: 1100upx;
- width: 100%;
- position: relative;
- }
- .data_items {
- width: 100%;
- }
- .item_box {
- width: 90%;
- margin: 0 auto;
- }
- .item_btn {
- border: 1upx solid #cccccc;
- border-radius: 78upx;
- width: 200upx;
- height: 80upx;
- text-align: center;
- line-height: 80upx;
- font-size: 28upx;
- margin-right: 10upx;
- margin-left: 10upx;
- margin-bottom: 20upx;
- }
- .item_btn:active {
- background: #ffd9b3;
- border: 2upx solid #ff7f00;
- }
- .item_type {
- display: flex;
- flex-wrap: wrap;
- margin-top: 20upx;
- }
- /* 物品保价弹框 */
- .valua_icon {
- width: 90%;
- position: absolute;
- bottom: 130upx;
- left: 40upx;
- }
- .input {
- width: 90%;
- margin: 0 auto;
- }
- .u-input--border {
- border-radius: 10upx;
- border-radius: 10upx;
- border: 2upx solid #F2F2F2 !important;
- background: #F2F2F2 !important;
- }
- .input_bg {
- width: 90%;
- margin: 0 auto;
- position: relative;
- }
- .input_bg image {
- width: 100%;
- height: 98upx;
- }
- .input_bg text {
- position: absolute;
- top: 30upx;
- left: 36upx;
- color: #FF7F00;
- font-size: 28upx;
- }
- /* 红包弹框 */
- .popup_money {
- /* height: 400upx; */
- width: 100%;
- height: 630rpx;
- position: relative;
- background: #F2EDED;
- padding-bottom: 45rpx;
- /* #ifndef MP-WEIXIN */
- height: 680rpx;
- /* #endif */
- }
- .uni-scroll-view,
- .uni-scroll-view-content {
- position: relative;
- width: 100%;
- height: 100%;
- background: #F2EDED;
- }
- .image_box {
- width: 40%;
- margin: 0 auto;
- margin-bottom: 110rpx;
- }
- .money_box {
- width: 93%;
- margin: 0 auto;
- background: #ffffff;
- border-radius: 16upx;
- height: 240upx;
- margin-top: 10rpx;
- /* margin-bottom: 35rpx; */
- /* margin-top: 20rpx; */
- }
- .box_tit {
- width: 90%;
- margin: 0 auto;
- height: 80upx;
- display: flex;
- }
- .money_name {
- flex: 1;
- display: flex;
- justify-content: left;
- align-items: center;
- font-size: 24upx;
- font-weight: bold;
- letter-spacing: 2upx;
- }
- .money_price {
- flex: 1;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- font-size: 36upx;
- font-weight: bold;
- color: red;
- }
- .money_data {
- color: #999999;
- font-size: 22upx;
- width: 90%;
- margin: 0 auto;
- margin-top: -10upx;
- }
- .u-line {
- width: 90% !important;
- border-bottom-width: 6upx !important;
- margin: 0 auto !important;
- margin-top: 24upx !important;
- margin-bottom: 24upx !important;
- }
- .box_bottom {
- width: 90%;
- margin: 0 auto;
- display: flex;
- height: 40upx;
- }
- .money_use {
- flex: 1;
- color: #999999;
- font-size: 22upx;
- display: flex;
- justify-content: left;
- align-items: center;
- }
- .lj_use {
- width: 160upx;
- border: 1upx solid #FF7F00;
- color: #FF7F00;
- text-align: center;
- line-height: 46upx;
- border-radius: 42upx;
- font-size: 20upx;
- }
- .help_pay {
- width: 100%;
- /* position: fixed;
- bottom: 120upx;
- left: 0upx;
- right: 0upx; */
- }
- .content {
- /* margin-top: -380upx; */
- /* position: relative; */
- /* z-index: 999; */
- }
- .part_one {
- width: 95%;
- margin: 0 auto;
- /* height: 190rpx; */
- background: #ffffff;
- border-radius: 20upx;
- padding: 25rpx 10rpx;
- }
- .pay_tit {
- width: 90%;
- margin: 0 auto;
- /* height: 200upx; */
- position: relative;
- }
- .pay_name {
- font-size: 32rpx;
- font-weight: bold;
- width: 95%;
- margin: 0 auto;
- letter-spacing: 1upx;
- /* padding-top: 30upx; */
- }
- .pay_set {
- color: #333333;
- font-size: 29upx;
- width: 95%;
- margin: 0 auto;
- /* margin-top: 20upx; */
- }
- .part_two {
- width: 95%;
- margin: 0 auto;
- padding: 20rpx 10rpx;
- background: #ffffff;
- border-radius: 15rpx;
- margin-top: 20rpx;
- }
- .tabs_box {
- display: none;
- margin-top: 10upx;
- }
- .dis {
- display: block;
- width: 100%;
- padding-bottom: 28rpx;
- }
- .part_three {
- width: 95%;
- margin: 0 auto;
- /* height: 335rpx; */
- background: #ffffff;
- border-radius: 20upx;
- margin-top: 20upx;
- }
- .u-form-item__body {
- position: relative !important;
- }
- .u-form-item--left {
- position: absolute !important;
- top: 30upx;
- left: 15rpx;
- font-size: 31rpx !important;
- font-weight: bold;
- letter-spacing: 2upx;
- }
- .u-form-item--right__content {
- margin-right: 20upx !important;
- }
- .u-form-item {
- line-height: 20upx !important;
- padding: 20rpx 0 !important;
- }
- .u-input__input {
- font-size: 31rpx !important;
- }
- .part_four {
- width: 95%;
- background: #ffffff;
- margin: 0 auto;
- border-radius: 20upx;
- display: flex;
- margin-top: 20upx;
- }
- .take_number {
- flex: 4;
- }
- .number_name {
- width: 90%;
- margin: 0 auto;
- font-size: 31upx;
- font-weight: bold;
- line-height: 80upx;
- }
- .number_text {
- width: 90%;
- margin: 0 auto;
- color: #999999;
- font-size: 25rpx;
- line-height: 20upx;
- }
- .take_number_kg {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .content_sure {
- display: flex;
- align-items: center;
- margin-bottom: 160rpx;
- margin-left: 30rpx;
- margin-top: 20rpx;
- /* #ifndef MP-WEIXIN */
- /* margin-bottom: 200px; */
- /* #endif */
- }
- .u-checkbox__label {
- font-size: 26rpx !important;
- letter-spacing: 2upx;
- color: #888888 !important;
- }
- .tabbar {
- width: 100%;
- height: 130rpx;
- background: #ffffff;
- position: fixed;
- bottom: 0upx;
- left: 0upx;
- right: 0upx;
- display: flex;
- /* #ifndef MP-WEIXIN */
- position: fixed;
- bottom: 0upx;
- left: 0upx;
- right: 0upx;
- /* #endif */
- z-index: 99;
- }
- .tabbar_price {
- flex: 1;
- display: flex;
- justify-content: left;
- align-items: center;
- font-size: 28upx;
- font-weight: bold;
- margin-left: 40upx;
- }
- .tabbar_price text {
- color: #FF3333;
- font-size: 36upx;
- font-weight: 500;
- }
- .tabbar_btn {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .but {
- background: #FF7F00;
- width: 240upx;
- height: 80upx;
- text-align: center;
- line-height: 80upx;
- border-radius: 60upx;
- color: white;
- font-size: 24upx;
- }
- .actclass {
- background-color: #FFD9B3;
- }
- .popup_pay {
- width: 100%;
- }
- .pay_btn {
- width: 90%;
- margin: 20rpx auto 40rpx;
- text-align: center;
- background: #FF7F00;
- height: 80rpx;
- border-radius: 16rpx;
- color: #ffffff;
- line-height: 80rpx;
- }
- .one_box {
- width: 100%;
- /* height: 80upx; */
- /* background: #F5F5F5; */
- margin: 0 auto;
- border-radius: 12upx;
- display: flex;
- /* height: 100rpx; */
- /* #ifndef MP-WEIXIN */
- padding: 0px 15px;
- /* #endif */
- }
- .box_jh {
- width: 90%;
- margin: 0 auto;
- line-height: 70rpx;
- }
- .box_jh image {
- width: 30upx;
- height: 30upx;
- }
- .box_dian {
- /* flex: 1; */
- width: 15%;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .box_dian image {
- width: 45rpx;
- height: 45rpx;
- }
- .box_name {
- flex: 5;
- display: flex;
- justify-content: left;
- align-items: center;
- color: #333333;
- font-weight: 700;
- }
- .box_addres {
- /* flex: 5; */
- width: 80%;
- font-size: 32rpx;
- overflow: hidden;
- }
- .box_addres1 {
- /* flex: 5; */
- width: 80%;
- font-size: 32rpx;
- overflow: hidden;
- text-align: right;
- }
- .name {
- display: inline;
- font-size: 31rpx;
- color: #999999;
- }
- .number {
- display: initial;
- color: #999999;
- font-size: 31rpx;
- margin-left: 30upx;
- }
- .box_image {
- width: 15%;
- /* margin-right: 22rpx; */
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .icon_you {
- color: #c0c4cc;
- }
- </style>
|