diff --git a/commons/js/config.js b/commons/js/config.js
index 1bb6e97..f123caf 100644
--- a/commons/js/config.js
+++ b/commons/js/config.js
@@ -21,6 +21,7 @@ if (env == "d") {
}
api = {
baseUrl: baseUrl,
+ upImg: baseUrl + "upimg", //上传图片
appUserUkey: "app/user/ukey", //登录/退出登录
appUser: "app/user", //用户信息
appSms: "app/sms", //获取验证码
@@ -30,6 +31,7 @@ api = {
appCustomers: "app/customers", //获取客户列表 /新建客户 /修改状态和到店次数、试驾次数 /获取客户详情
appCustomersFilter: "app/customers/filter", //获取列表筛选条件
appSmsCustomer: "app/sms/customer", //发短信
+ appSmsCusorder: "app/sms/cusorder", //发短信
appCustomerlogs: "app/customerlogs", //获取日志
appCustomerData: "app/customers/data", //获取客户详细信息
@@ -39,6 +41,9 @@ api = {
appEmployees: "app/employees", //获取客户详细信息 /获取店员列表 /更新店员信息 /删除店员
appLoan: "app/loan", //获取贷款产品信息 /创建贷款信息 /修改贷款信息
+
+ appIdcard: "app/idcard", //创建申请开票信息
+
}
diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js
index 244401e..035c781 100644
--- a/commons/js/utils/apiQuery.js
+++ b/commons/js/utils/apiQuery.js
@@ -257,4 +257,18 @@ apiQuery.putAppLoan = function (params) {
})
}
+//创建申请开票信息
+apiQuery.postAppIdcard = function (params) {
+ return new Promise(function (resolve, reject) {
+ HttpRequest(true, Config.api.appIdcard, 2, params, "POST", resolve, reject)
+ })
+}
+
+//修改申请开票信息
+apiQuery.putAppIdcard = function (params) {
+ return new Promise(function (resolve, reject) {
+ HttpRequest(true, Config.api.appIdcard, 2, params, "PUT", resolve, reject)
+ })
+}
+
export default apiQuery;
\ No newline at end of file
diff --git a/commons/js/utils/httpRequest.js b/commons/js/utils/httpRequest.js
index 6c27a20..9f7e8bd 100644
--- a/commons/js/utils/httpRequest.js
+++ b/commons/js/utils/httpRequest.js
@@ -108,7 +108,7 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje
url: '/pages/login/index'
})
//}
- } else{
+ }else{
if (res.data.code==200){
callBack(res.data);
}else{
@@ -117,10 +117,12 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje
if (Config.white401UrlList[url] === url) {//接口白名单
return
}
- wx.showToast({
- title: res.data.msg,
- icon: "none"
- });
+ if(res.data.msg){
+ wx.showToast({
+ title: res.data.msg,
+ icon: "none"
+ });
+ }
}
}
},
diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js
index 3c5c97d..5960d63 100644
--- a/pages/order/detail/index.js
+++ b/pages/order/detail/index.js
@@ -19,9 +19,17 @@ Page({
yearsIndex:-1,//分期年限
money:'',//首付金额
submitFlag:false,
- stempFront:'',
- stempBack:'',
+ frontUrl:{},
+ backUrl:{},
isShowCode:false,
+ caridErr:[
+ {
+ caridA:true,
+ },
+ {
+ caridB:true,
+ },
+ ],
},
onLoad: function (options) {
for (let key in options) {
@@ -260,17 +268,38 @@ Page({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
- console.log(res)
- if(e.currentTarget.dataset.face == 'front'){
- that.setData({
- stempFront:res.tempFilePaths[0],
- })
- }
- if(e.currentTarget.dataset.face == 'back'){
- that.setData({
- stempBack:res.tempFilePaths[0],
- })
- }
+
+ wx.showLoading();
+ wx.uploadFile({
+ url:_.config.api.upImg,
+ filePath:res.tempFilePaths[0],
+ name: 'img',
+ formData: {
+ 'app': 'liche'
+ },
+ success: (resp) => {
+ resp.data = JSON.parse(resp.data);
+ wx.hideLoading();
+ if (resp.data.code == 200) {
+
+ if(e.currentTarget.dataset.face == 'front'){
+ that.setData({
+ frontUrl:resp.data.data,
+ 'caridErr[0].caridA':true,
+ })
+ }
+ if(e.currentTarget.dataset.face == 'back'){
+ that.setData({
+ backUrl:resp.data.data,
+ 'caridErr[1].caridB':true,
+ })
+ }
+
+ }
+ },
+
+ })
+
},
fail: res => {
wx.showToast({
@@ -282,6 +311,91 @@ Page({
})
},
+ //创建申请开票信息
+ postAppIdcard(){
+ let that = this
+ if (!that.data.frontUrl.url || !that.data.caridErr[0].caridA){
+ wx.showToast({
+ title: '请上传身份证正面照',
+ icon: 'none'
+ })
+ }else if(!that.data.backUrl.url || !that.data.caridErr[1].caridB){
+ wx.showToast({
+ title: '请上传身份证背面照',
+ icon: 'none'
+ })
+ }else{
+ that.setData({
+ submitFlag: true,
+ })
+ let params = {};
+ params['oid'] = that.data.id;
+ params['cardidA'] = that.data.frontUrl.url;
+ params['cardidB'] = that.data.backUrl.url;
+ _.apiQuery.postAppIdcard(params).then(res => {
+ this.setData({
+ submitFlag: false,
+ })
+ this.getAppCusorderDetails()
+
+ wx.showToast({
+ title: '已提交申请',
+ icon: 'success'
+ })
+
+ }).catch(res=>{
+ if(res.code==418){
+ this.setData({
+ caridErr:res.data,
+ })
+ }
+ this.setData({
+ submitFlag: false,
+ })
+ });
+ }
+ },
+
+ //修改申请开票信息
+ putAppIdcard() {
+ let that = this
+ if (!that.data.frontUrl.url&&!that.data.backUrl.url) {
+ wx.showToast({
+ title: '请上传新照片',
+ icon: 'none'
+ })
+ }else{
+ that.setData({
+ submitFlag: true,
+ })
+ let params = {};
+ params['id'] = that.data.info.bill_data.id;
+ params['cardidA'] = that.data.frontUrl.url || that.data.info.bill_data.carid_a_path;
+ params['cardidB'] = that.data.backUrl.url || that.data.info.bill_data.carid_b_path;
+ _.apiQuery.putAppIdcard(params).then(res => {
+ this.setData({
+ submitFlag: false,
+ })
+ this.getAppCusorderDetails()
+
+ wx.showToast({
+ title: '已提交修改',
+ icon: 'success'
+ })
+
+ }).catch(res=>{
+ if(res.code==418){
+ this.setData({
+ caridErr:res.data,
+ })
+ }
+ this.setData({
+ submitFlag: false,
+ })
+ });
+ }
+ },
+
//客服微信码
optShowCode() {
this.setData({
diff --git a/pages/order/detail/index.wxml b/pages/order/detail/index.wxml
index da29f9d..8553c23 100644
--- a/pages/order/detail/index.wxml
+++ b/pages/order/detail/index.wxml
@@ -106,16 +106,16 @@
-
- 系统识别失败请重新上传
+
+ {{caridErr[0].errmsg}}
-
+
-
- 系统识别失败请重新上传
+
+ {{caridErr[1].errmsg}}
-
+
@@ -126,19 +126,19 @@
-
+
-
+
-
+
-
+