diff --git a/common/js/api.js b/common/js/api.js index a65ed96..595e585 100644 --- a/common/js/api.js +++ b/common/js/api.js @@ -95,4 +95,7 @@ export default { usergetwechatjssdk(data) { return uni.api.post("user/getwechatjssdk", data); }, + h5encryption(data) { + return uni.api.post("store/h5encryption", data); + }, } \ No newline at end of file diff --git a/framework/0-conf.js b/framework/0-conf.js index 59b6d46..8053471 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -1,15 +1,16 @@ const uploadUrl = 'https://upload-z2.qbox.me' // const debug = process.env.NODE_ENV === 'development' const debug = process.env.NODE_ENV == 'development' ? true : false; +const proxyApi = "/api/" // #ifdef H5 -// const baseUrl = debug ? proxyApi : "http://wxgzh.sxczgkj.cn" +// const baseUrl = debug ? proxyApi : "https://invoice.sxczgkj.cn/api/" const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式 // const baseUrl = 'http://192.168.2.23:8888/api/'//正式 // const baseUrl = 'http://test.invoice.sxczgkj.cn/api/'//测试 // #endif import VConsole from "./vConsole.js" if (debug) { - new VConsole() + // new VConsole() } const version = '120' const autoRemoveCache = { diff --git a/framework/11-api.js b/framework/11-api.js index 4a5f6e5..f8efa02 100644 --- a/framework/11-api.js +++ b/framework/11-api.js @@ -1,5 +1,5 @@ const preCacheKeyClearFetch = 'storage:clear:fetch:' - +import Api from '@/common/js/api.js' uni.pro.interceptor('request', { config(paramOptions) { let options = Object.assign({}, paramOptions) @@ -39,7 +39,9 @@ async function request(options) { } options.header = { userId: uni.getStorageSync('userId'), - minitype:uni.getStorageSync('Type'), + minitype: uni.getStorageSync('Type'), + fatoken: uni.getStorageSync('token'), + isnew: 'isnew', 'content-type': 'application/json' } let res = await uni.pro.request(options) @@ -59,18 +61,13 @@ async function request(options) { } if (res.code == 400) { return Promise.reject(res.message) - } else if (res.code == 401) { - uni.showToast({ - title: res.message || res.msg, - icon: "none", - success: () => { - uni.cache.clear(); - uni.removeStorageSync("token"); - uni.removeStorageSync("userId"); - uni.removeStorageSync('myLoginName') - uni.pro.redirectTo("login/login"); - } + } else if (res.code == 405) { + let token = await Api.h5encryption({ + store_id: uni.cache.get('userId') }) + if (token.code == 1) { + uni.cache.set('token', token.data.token); + } } else if (res.code == 482) { let nowTime = new Date() / 1000 | 0 let offset = parseInt(res.message) - parseInt(nowTime); diff --git a/main.js b/main.js index adb54e2..eebe84d 100644 --- a/main.js +++ b/main.js @@ -10,22 +10,29 @@ Vue.config.productionTip = false import uView from '@/uni_modules/uview-ui' Vue.prototype.$store = store Vue.prototype.api = Api; +// 让页面的 onLoad 在 onLaunch 之后执行 +Vue.prototype.$onLaunched = new Promise(resolve => { + Vue.prototype.$isResolve = resolve +}) Vue.use(uView) // 如此配置即可 App.mpType = 'app' const app = new Vue({ store, - ...App + ...App }) app.$mount() // #endif + // #ifdef VUE3 -import { createSSRApp } from 'vue' +import { + createSSRApp +} from 'vue' export function createApp() { - const app = createSSRApp(App) - return { - app - } + const app = createSSRApp(App) + return { + app + } } // #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json index 3227787..cacdf7d 100644 --- a/manifest.json +++ b/manifest.json @@ -64,7 +64,7 @@ "disableHostCheck" : false, "proxy" : { "/api" : { - "target" : "https://ky.sxczgkj.cn/api/", + "target" : "http://192.168.1.13:8888/api/", "ws" : false, "changeOrigin" : true, //是否跨域 "secure" : false, // 设置支持https协议的代理 diff --git a/pages.json b/pages.json index cde0b9e..a307ab7 100644 --- a/pages.json +++ b/pages.json @@ -9,12 +9,6 @@ "navigationBarTitleText": "开票", "navigationStyle": "custom" } - },{ - "path": "pages/hindex/indexess", - "style": { - "navigationBarTitleText": "开票", - "navigationStyle": "custom" - } }, { "path": "pages/index/information", "style": { @@ -124,6 +118,11 @@ "navigationBarTitleText": "提交成功", "navigationStyle": "custom" } + }, { + "path": "pages/electric/index", + "style": { + "navigationBarTitleText": "" + } }, { "path": "pages/webview/webview", "style": { diff --git a/pages/electric/index.vue b/pages/electric/index.vue new file mode 100644 index 0000000..2d5f3df --- /dev/null +++ b/pages/electric/index.vue @@ -0,0 +1,230 @@ + + + + + \ No newline at end of file diff --git a/pages/hindex/index.vue b/pages/hindex/index.vue index bd98509..662415a 100644 --- a/pages/hindex/index.vue +++ b/pages/hindex/index.vue @@ -189,22 +189,12 @@ _this.form.user_duty = infoJ.taxNumber ? infoJ.taxNumber : '' //税号 _this.form.c_address = infoJ.companyAddress ? infoJ.companyAddress : '' //公司地址 _this.form.c_phone = infoJ.telephone ? infoJ.telephone : '' //电话 - _this.form.c_bank_name = infoJ.bankAccount ? infoJ.bankAccount : '' //开户银行 - _this.form.c_bank_account = infoJ.bankName ? infoJ.bankName : '' // 银行账号 + _this.form.c_bank_account = infoJ.bankAccount ? infoJ.bankAccount : '' //开户银行 + _this.form.c_bank_name = infoJ.bankName ? infoJ.bankName : '' // 银行账号 _this.form.user_type = infoJ.type == 0 ? 2 : 1 //发票抬头类型 微信返回0是企业 1是个人 - // form: { - // user_type: 2, - // img: '', - // user_name: '', - // user_duty: '', - // email: '', - // mobile: '', - // status_note: '', - // c_address: '', - // c_phone: '', - // c_bank_name: '', - // c_bank_account: '' - // }, + if (infoJ.type == 0) { + _this.showElse = true + } }) }, onInput(e) { @@ -368,7 +358,10 @@ this.form.img = ''; this.form.user_duty = ''; this.form.email = ''; - this.form.mobile = ''; + this.form.c_address = ''; + this.form.c_phone = ''; + this.form.c_bank_account = ''; + this.form.c_bank_name = ''; }, async getOrder() { //搜索值 let res = await this.api.enterprisestore({ diff --git a/pages/index/Invoicing.vue b/pages/index/Invoicing.vue index d287a83..63407fa 100644 --- a/pages/index/Invoicing.vue +++ b/pages/index/Invoicing.vue @@ -18,14 +18,7 @@ - - 规格型号 - - - - 单位 - - + *发票类型 @@ -48,6 +41,25 @@ {{ form.dlzhid || '请选择开票人' }} + 备注: @@ -86,13 +98,14 @@ Uploadurlnumber: '', namelang: '', merchantAuditStatus: '', + showElse: false, form: { store_id: uni.getStorageSync('userId'), article: uni.cache.get('keyword').name, type: '', price: '', se_amount: '', - number: '', + number: 1, tax_amount: '', d_price: '', notes: '', @@ -172,6 +185,7 @@ } }, async showpickerconfirm(e) { + console.log(e, 1) if (this.form.price == null || this.form.price == '') { uni.showToast({ title: '请输入开票金额', @@ -193,6 +207,17 @@ } else { this.form.se_amount = 3 } + switch (e.value[1]) { + case '1%': + this.form.se_amount = 1 + break; + case '3%': + this.form.se_amount = 3 + break; + case '6%': + this.form.se_amount = 6 + break; + } this.form.type = e.value.toString(); } } catch (e) { @@ -271,6 +296,13 @@ }); return false; } + if([...this.form.dw].length > 22){ + uni.showToast({ + title: '单位不能多余22个字体!', + icon: 'none' + }); + return false; + } let res = await this.api.storesubinvoicing(this.form) if (res) { this.form = { @@ -301,7 +333,24 @@ page { background: #fff; } - + .arrow { + display: flex; + align-items: center; + + .t { + margin-right: 8upx; + color: #808080; + font-size: 32upx; + } + + .arrow-icon { + transition: all 0.3s ease-in-out; + + &.active { + transform: rotate(180deg); + } + } + } .Box { .Box_box_O { padding: 0 28rpx; diff --git a/pages/index/auditbilling.vue b/pages/index/auditbilling.vue index dffef57..5b72615 100644 --- a/pages/index/auditbilling.vue +++ b/pages/index/auditbilling.vue @@ -79,6 +79,14 @@ } catch (e) { //TODO handle the exception } + let token = await this.api.h5encryption({ + store_id: uni.cache.get('userId') + }) + if (token.code == 1) { + uni.cache.set('token', token.data.token); + } else { + return false + } }, onShow() { this.list = [] diff --git a/pages/index/index.vue b/pages/index/index.vue index c346eca..82c98e3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -65,20 +65,27 @@ }; }, async onLoad(e) { + // await this.$onLaunched; + // alert(location.href.split('#')[0]) if (e.userId) { // this.onLoaduserId = e.userId uni.cache.set('Type', e.type); uni.cache.set('userId', e.userId); } - // this.jumpToMiniProgram() + let token = await this.api.h5encryption({ + store_id: uni.cache.get('userId') + }) + if (token.code == 1) { + uni.cache.set('token', token.data.token); + } + console.log(token) let res = await this.api.storestorestatus({ store_id: uni.cache.get('userId') }) if (res.code == 1) { this.improveinformationform = res.data.store uni.cache.set('form', this.improveinformationform); - // uni.cache.set('userId', this.improveinformationform.id); if (res.data.sz_status == 0) { uni.reLaunch({ url: '/pages/index/information' @@ -198,7 +205,7 @@ let res = await this.api.szzpyhurl({ store_id: uni.getStorageSync('userId') }) - if(res){ + if (res) { uni.pro.navigateTo('webview/webview', { url: res.data.url, tape: 1 diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html index 520aadf..65ba4ab 100644 --- a/unpackage/dist/build/web/index.html +++ b/unpackage/dist/build/web/index.html @@ -3,4 +3,4 @@ document.write( '')
\ No newline at end of file + '" />')
\ No newline at end of file