需开具本地发票
This commit is contained in:
Vendored
-1
File diff suppressed because one or more lines are too long
@@ -47,155 +47,9 @@ function isOpenCard() {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得用户位置,返回一个promise,同时间只会跑一个
|
||||
* {
|
||||
* lat,
|
||||
* lng,
|
||||
* from_storage //true表示是从缓存里获得, false表示从设置里获得
|
||||
* }
|
||||
*/
|
||||
// function getUserLocation() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// // const lat = wx.getStorageSync('u_lat');
|
||||
// // const lng = wx.getStorageSync('u_lng');
|
||||
// // if (lat && lng) {
|
||||
// // return resolve({
|
||||
// // lat,
|
||||
// // lng,
|
||||
// // from_storage: true,
|
||||
// // })
|
||||
// // } else {
|
||||
// const loading = wx.getStorageSync('loading_gps');
|
||||
// if (loading) {
|
||||
// setTimeout(() => {
|
||||
// return resolve(this.getUserLocation());
|
||||
// }, 30);
|
||||
// return;
|
||||
// }
|
||||
// wx.setStorageSync('loading_gps', 1)
|
||||
// wx.getSetting({
|
||||
// success(res) {
|
||||
// console.log("======获取用户地理位置=====")
|
||||
// console.log(res);
|
||||
// wx.getLocation({
|
||||
// type: 'gcj02',
|
||||
// success: function (res) {
|
||||
// var lat = res.latitude
|
||||
// var lng = res.longitude
|
||||
// wx.setStorageSync('u_lat', lat)
|
||||
// wx.setStorageSync('u_lng', lng)
|
||||
// wx.removeStorageSync('loading_gps')
|
||||
// return resolve({
|
||||
// lat,
|
||||
// lng,
|
||||
// from_storage: false,
|
||||
// })
|
||||
// },
|
||||
// fail: function (res) {
|
||||
// console.log("用户没有授权地理位置")
|
||||
// console.log(res);
|
||||
// wx.removeStorageSync('loading_gps')
|
||||
// wx.showModal({
|
||||
// title: '提示',
|
||||
// content: '请先授权地理位置权限',
|
||||
// showCancel: false,
|
||||
// success(res) {
|
||||
// if (res.confirm) {
|
||||
// console.log('用户点击确定')
|
||||
// wx.openSetting({
|
||||
// success(res) {
|
||||
// console.log(res.authSetting)
|
||||
|
||||
// }
|
||||
// })
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消')
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return reject('用户没有授权地理位置')
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// })
|
||||
// // }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
const getUserLocation = function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
wx.getLocation({
|
||||
type: 'wgs84',
|
||||
success(res) {
|
||||
app.setStorage('u_lat', res.latitude)
|
||||
app.setStorage('u_lng', res.longitude)
|
||||
resolve({
|
||||
lat:res.latitude,
|
||||
lng:res.longitude,
|
||||
from_storage: false,
|
||||
});
|
||||
},
|
||||
fail(res) {
|
||||
app.printErrorClient('userLocationFail', ['错误信息:'+ JSON.stringify(res)])
|
||||
_ModelForGetLocationModel(resolve, reject);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function _ModelForGetLocationModel(resolve, reject) {
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '检测到你未打开地理位置的权限,是否前往开启',
|
||||
confirmText: '前往开启',
|
||||
showCancel:false,
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
//成功的时候只执行一次(通过手动的时候就没执行了)
|
||||
wx.openSetting({
|
||||
success(res) {
|
||||
wx.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
// resolve("toggle");
|
||||
wx.getLocation({
|
||||
type: 'wgs84',
|
||||
success(res) {
|
||||
app.setStorage('u_lat', res.latitude)
|
||||
app.setStorage('u_lng', res.longitude)
|
||||
resolve({
|
||||
lat:res.latitude,
|
||||
lng:res.longitude,
|
||||
from_storage: false,
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
app.printErrorClient('userLocationFail',['错误信息:打开打开地理位置的权限,未设置'])
|
||||
_ModelForGetLocationModel(resolve, reject);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
app.printErrorClient('userLocationFail',['错误信息:用户点击取消'])
|
||||
reject()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
getAjaxUserInfo,
|
||||
isAuthUserInfo,
|
||||
isBindMobile,
|
||||
isOpenCard,
|
||||
getUserLocation
|
||||
// getLocation
|
||||
}
|
||||
@@ -74,6 +74,8 @@ Page({
|
||||
|
||||
sa:'',//特别约定
|
||||
|
||||
if_local_bill:0,//本地开具发票
|
||||
|
||||
},
|
||||
//生命周期函数--监听页面加载
|
||||
onLoad: function (options) {
|
||||
@@ -100,6 +102,7 @@ Page({
|
||||
delry_time:res.data.delry_time?res.data.delry_time:'',
|
||||
sa:res.data.sa?res.data.sa:'',
|
||||
//if_fine:res.data.if_fine==1?true:false,
|
||||
if_local_bill:res.data.if_local_bill==1?1:0,
|
||||
})
|
||||
|
||||
/*匹配车辆信息*/
|
||||
@@ -819,6 +822,9 @@ Page({
|
||||
if(that.data.sa != ''){
|
||||
params['sa'] = that.data.sa;
|
||||
}
|
||||
if(that.data.priceinfo.show_local_bill){
|
||||
params['if_local_bill'] = that.data.if_local_bill;
|
||||
}
|
||||
let srv_arr = []
|
||||
that.data.agencyList.forEach(item => {
|
||||
if(item.checked){
|
||||
@@ -1140,6 +1146,13 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
//需开具本地发票
|
||||
switchAddrDef:function(e){
|
||||
this.setData({
|
||||
if_local_bill:e.detail.value ? 1 :0
|
||||
})
|
||||
},
|
||||
|
||||
//页面相关事件处理函数--监听用户下拉动作
|
||||
onPullDownRefresh(){
|
||||
this.getAppCusorderV2()
|
||||
|
||||
@@ -261,8 +261,13 @@
|
||||
<textarea class="wp100 mt20 inner20 line-height-16 bg-f6 font-28 ulib-r10" style="height:180rpx;" placeholder-class="color-ccc" placeholder="请填写特别约定" model:value='{{sa}}' always-embed='{{true}}' />
|
||||
</block>
|
||||
</block>
|
||||
<view class="relative bbs-1-eb last-b-none pl180 font-28" wx:if="{{priceinfo.show_local_bill}}">
|
||||
<view class="absolute left-0 box-middle">需开具本地发票</view>
|
||||
<view class="relative pt30 pb30 text-right">
|
||||
<switch checked="{{if_local_bill}}" bindchange="switchAddrDef" type="switch" color='#36afa2' style="zoom:0.8" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="fixed left-0 right-0 bottom-0 bg-fff-op90 inner40 fn-flex safe-pb">
|
||||
@@ -368,6 +373,10 @@
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view class="relative bbs-1-eb last-b-none pl180 font-28" wx:if="{{priceinfo.show_local_bill}}">
|
||||
<view class="absolute left-0 box-middle color-333">需开具本地发票</view>
|
||||
<view class="pt30 pb30 text-right font-28 color-666" style="height:38rpx;">{{if_local_bill?'需要':'不需要'}}</view>
|
||||
</view>
|
||||
<block wx:if="{{userInfo.show_sa}}">
|
||||
<view class="relative pt30 font-28 color-333">特别约定</view>
|
||||
<view class="mt20 inner30 bds-1-eb line-height-16 font-28 color-666 ulib-r10">{{sa}}</view>
|
||||
|
||||
@@ -93,6 +93,8 @@ Page({
|
||||
|
||||
sa:'',//特别约定
|
||||
|
||||
if_local_bill:0,//本地开具发票
|
||||
|
||||
},
|
||||
//生命周期函数--监听页面加载
|
||||
onLoad: function (options) {
|
||||
@@ -644,6 +646,9 @@ Page({
|
||||
if(that.data.sa != ''){
|
||||
params['sa'] = that.data.sa;
|
||||
}
|
||||
if(that.data.priceinfo.show_local_bill){
|
||||
params['if_local_bill'] = that.data.if_local_bill;
|
||||
}
|
||||
let srv_arr = []
|
||||
that.data.agencyList.forEach(item => {
|
||||
if(item.checked){
|
||||
@@ -1131,4 +1136,11 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
//需开具本地发票
|
||||
switchAddrDef:function(e){
|
||||
this.setData({
|
||||
if_local_bill:e.detail.value ? 1 :0
|
||||
})
|
||||
},
|
||||
|
||||
})
|
||||
@@ -312,8 +312,13 @@
|
||||
<view class="relative pt30 font-28 color-333">特别约定</view>
|
||||
<textarea class="wp100 mt20 inner20 line-height-16 bg-f6 font-28 ulib-r10" style="height:180rpx;" placeholder-class="color-ccc" placeholder="请填写特别约定" model:value='{{sa}}' always-embed='{{true}}' />
|
||||
</block>
|
||||
<view class="relative bbs-1-eb last-b-none pl180 font-28" wx:if="{{priceinfo.show_local_bill}}">
|
||||
<view class="absolute left-0 box-middle">需开具本地发票</view>
|
||||
<view class="relative pt30 pb30 text-right">
|
||||
<switch checked="{{if_local_bill}}" bindchange="switchAddrDef" type="switch" color='#36afa2' style="zoom:0.8" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="fixed left-0 right-0 bottom-0 bg-fff-op90 inner40 fn-flex safe-pb">
|
||||
@@ -500,6 +505,10 @@
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view class="relative bbs-1-eb last-b-none pl180 font-28" wx:if="{{priceinfo.show_local_bill}}">
|
||||
<view class="absolute left-0 box-middle color-333">需开具本地发票</view>
|
||||
<view class="pt30 pb30 text-right font-28 color-666" style="height:38rpx;">{{if_local_bill?'需要':'不需要'}}</view>
|
||||
</view>
|
||||
<block wx:if="{{userInfo.show_sa}}">
|
||||
<view class="relative pt30 font-28 color-333">特别约定</view>
|
||||
<view class="mt20 inner30 bds-1-eb line-height-16 font-28 color-666 ulib-r10">{{sa}}</view>
|
||||
|
||||
Reference in New Issue
Block a user