diff --git a/common/http.api.js b/common/http.api.js index 4233483..4aafb3b 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -4,6 +4,7 @@ let apiApp = { user: '/api/mobile/user/show', saveUser: '/api/mobile/user/save', getUserMobile: '/api/mobile/user/mobile', + getConfig: '/api/mobile/user/config', getUserAddress: '/api/mobile/user/address', saveUserAddress: '/api/mobile/user/address-update', @@ -12,7 +13,9 @@ let apiApp = { saveFeedback: '/api/mobile/user/feedback-update', getCard: '/api/mobile/user/get-card', - getDates: '/api/mobile/user/get-available-dates', + getDates: '/api/mobile/user/get-available-dates', + getExpress:'/api/mobile/user/express-type', + getUserOrder: '/api/mobile/user/delivery', addUserOrder: '/api/mobile/user/confirm', @@ -32,13 +35,17 @@ const install = (Vue, vm) => { let login = (params = {}) => vm.$u.get(apiApp.login, params); let user = (params = {}) => vm.$u.get(apiApp.user, params); let getUserMobile = (params = {}) => vm.$u.get(apiApp.getUserMobile, params); + let getConfig = (params = {}) => vm.$u.get(apiApp.getConfig, params); + let saveUser = (params = {}) => vm.$u.post(apiApp.saveUser, params); let getUserAddress = (params = {}) => vm.$u.get(apiApp.getUserAddress, params); let saveUserAddress = (params = {}) => vm.$u.post(apiApp.saveUserAddress, params); let delUserAddress = (params = {}) => vm.$u.get(apiApp.delUserAddress, params); let saveFeedback = (params = {}) => vm.$u.post(apiApp.saveFeedback, params); let getCard = (params = {}) => vm.$u.get(apiApp.getCard, params); - let getDates = (params = {}) => vm.$u.get(apiApp.getDates, params); + let getDates = (params = {}) => vm.$u.get(apiApp.getDates, params); + let getExpress = (params = {}) => vm.$u.get(apiApp.getExpress, params); + let getUserOrder = (params = {}) => vm.$u.get(apiApp.getUserOrder, params); let addUserOrder = (params = {}) => vm.$u.post(apiApp.addUserOrder, params); @@ -50,14 +57,16 @@ const install = (Vue, vm) => { vm.$u.api = { login, user, - getUserMobile, + getUserMobile, + getConfig, saveUser, getUserAddress, saveUserAddress, delUserAddress, saveFeedback, - getCard, - getDates, + getCard, + getDates, + getExpress, getUserOrder, addUserOrder, saveUserOrder, diff --git a/components/date-picker/date-picker.vue b/components/date-picker/date-picker.vue index 3b91381..e860ce7 100644 --- a/components/date-picker/date-picker.vue +++ b/components/date-picker/date-picker.vue @@ -12,7 +12,7 @@ {{item.value}} + v-if="item.name">{{item.name}} 送货时间 @@ -26,11 +26,13 @@ - + {{dateObj.lunarData?dateObj.lunarData:''}} + 今日剩余可提货量:{{dateObj.canUse.quantity - dateObj.canUse.booked}} - {{item}} @@ -45,8 +47,12 @@ - \ No newline at end of file diff --git a/pages/change/change.vue b/packages/change/change.vue similarity index 100% rename from pages/change/change.vue rename to packages/change/change.vue diff --git a/packages/my/addaddress.vue b/packages/my/addaddress.vue index 078145c..a73e446 100644 --- a/packages/my/addaddress.vue +++ b/packages/my/addaddress.vue @@ -1,36 +1,52 @@ @@ -39,7 +55,7 @@ toast, isMobile, isNull - } from '@/common/util.js' + } from '@/common/util.js' import auiPicker from '@/components/aui-picker.vue'; export default { components: { @@ -47,14 +63,15 @@ }, data() { return { + itemtype: 'add', form: { area: '', address: '', contact: '', - mobile: '', - defalut:false - }, - listArea:[], + mobile: '', + defalut: false + }, + listArea: [], showArea: false, rules: { area: [{ @@ -90,73 +107,80 @@ this.$refs.uForm.setRules(this.rules); }, - onLoad(option) { - if(uni.getStorageSync('vuex_address')){ - this.form = uni.getStorageSync('vuex_address') - uni.removeStorageSync('vuex_address') - } + onLoad(option) { + this.itemtype = option.type ? option.type : '' + if (uni.getStorageSync('vuex_address')) { + this.form = uni.getStorageSync('vuex_address') + if (this.itemtype === 'copy') { + this.form.id = '' + this.form.defalut = 0 + } + uni.removeStorageSync('vuex_address') + } this.getArea() }, - methods: { - async getArea() { - const res = await this.$u.api.getRegion() - this.listArea = res.regions - }, - openArea() { - this.$refs.pickers.open().then(function() { - console.log('picker打开'); - }); - }, - changeArea(e) { - console.log(e) - // return - if (e) { - - let data = e.data - let _this = this - _this.form.area='' - data.forEach(function(item, index) { - _this.form.area += item.value + ''; - }); - this.form.province_id = data[0] ? data[0].id : '' - this.form.city_id = data[1] ? data[1].id : '' - this.form.district_id = data[2] ? data[2].id : '' - } - }, - getAddress(){ - let _this = this - uni.authorize({ - scope: 'scope.address', - success: (res) => { - console.log("authorize", res) - uni.chooseAddress({ - success(res){ - console.log(res) - _this.form.contact = res.userName - _this.form.mobile = res.telNumber - _this.form.area = res.provinceName+res.cityName+res.countyName - _this.form.address = res.detailInfo - _this.$u.api.matchRegion({ - province: res.provinceName, - city: res.cityName, - district: res.countyName - }).then(res1 => { - _this.form.province_id = res1.province_id ? res1.province_id.id : '' - _this.form.city_id = res1.city_id ? res1.city_id.id : '' - _this.form.district_id = res1.district_id ? res1.district_id.id : '' - }) - console.log("_this",_this.form) - }, - fail(res){ - console.log(res) - } - }) - }, - fail(res) { - console.log("authorize-fail", res) - } - }) - + methods: { + async getArea() { + const res = await this.$u.api.getRegion() + this.listArea = res.regions + }, + openArea() { + this.$refs.pickers.open().then(function() { + console.log('picker打开'); + }); + }, + changeArea(e) { + console.log(e) + // return + if (e) { + + let data = e.data + let _this = this + _this.form.area = '' + data.forEach(function(item, index) { + _this.form.area += item.value + ''; + }); + this.form.province_id = data[0] ? data[0].id : '' + this.form.city_id = data[1] ? data[1].id : '' + this.form.district_id = data[2] ? data[2].id : '' + } + }, + getAddress() { + let _this = this + uni.authorize({ + scope: 'scope.address', + success: (res) => { + console.log("authorize", res) + uni.chooseAddress({ + success(res) { + console.log(res) + _this.form.contact = res.userName + _this.form.mobile = res.telNumber + _this.form.area = res.provinceName + res.cityName + res.countyName + _this.form.address = res.detailInfo + _this.$u.api.matchRegion({ + province: res.provinceName, + city: res.cityName, + district: res.countyName + }).then(res1 => { + _this.form.province_id = res1.province_id ? res1 + .province_id.id : '' + _this.form.city_id = res1.city_id ? res1.city_id.id : '' + _this.form.district_id = res1.district_id ? res1 + .district_id.id : '' + }) + console.log("_this", _this.form) + }, + fail(res) { + console.log(res) + } + }) + }, + fail(res) { + console.log("authorize-fail", res) + } + }) + }, changeLocation() { let _this = this @@ -180,23 +204,23 @@ } }) }, - submit() { - console.log(this.form) + submit() { + console.log(this.form) // return this.$refs.uForm.validate(valid => { - - if (valid) { - if(this.form.defalut){ - this.form.defalut = 1 - } - this.$u.api.saveUserAddress(this.form).then(res=>{ - toast('提交成功',1000,function(){ - setTimeout(function(){ - uni.navigateBack(-1) - },500) - - }) - + + if (valid) { + if (this.form.defalut) { + this.form.defalut = 1 + } + this.$u.api.saveUserAddress(this.form).then(res => { + toast('提交成功', 1000, function() { + setTimeout(function() { + uni.navigateBack(-1) + }, 500) + + }) + }) } else { console.log('验证失败'); @@ -211,43 +235,48 @@ \ No newline at end of file diff --git a/packages/my/score.vue b/packages/my/score.vue index 3b97d03..c9fad09 100644 --- a/packages/my/score.vue +++ b/packages/my/score.vue @@ -1,38 +1,38 @@