From 499a94ded67a4c1e763dc6686afe5a2e99faf407 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 24 七月 2024 11:09:20 +0800 Subject: [PATCH] update 订单功能(花店端) --- sub_pages/customer/trade/list.vue | 138 ++-- sub_pages/supplier/supplier-info/supplier-info.vue | 4 pages/help/help.vue | 17 pages.json | 10 mixin/mixin.js | 7 static/common/icon-dp.png | 0 components/common-address-select/common-address-select.vue | 4 plugins/qqmap-wx-jssdk.min.js | 1 pages/user/address/address.vue | 773 ++++++++++++---------- store/index.js | 1 sub_pages/customer/self/follow.vue | 140 +++ manifest.json | 10 sub_pages/customer/self/collect.vue | 2 sub_pages/customer/shop/shop.vue | 115 ++- sub_pages/customer/shopping/confirm.vue | 248 ++++++ pages/user/supplier-user.vue | 555 ++++++++------- 16 files changed, 1,255 insertions(+), 770 deletions(-) diff --git a/components/common-address-select/common-address-select.vue b/components/common-address-select/common-address-select.vue index e0f61ea..82cfc27 100644 --- a/components/common-address-select/common-address-select.vue +++ b/components/common-address-select/common-address-select.vue @@ -45,7 +45,7 @@ //获取默认地址并且填充 if(!this.address.id){ this.$message.showLoading() - const {data} = await this.$http.request('get','/api/address/customer/default/get') + const {data} = await this.$http.request('get','/api/address/default/detail') this.$message.hideLoading() if(data){ //提交更新默认地址 @@ -60,7 +60,7 @@ return } uni.navigateTo({ - url:'/pages/address/address?source=select' + url:'/pages/user/address/address?source=select' }) } }, diff --git a/manifest.json b/manifest.json index 444f1a4..9ab5b86 100644 --- a/manifest.json +++ b/manifest.json @@ -56,7 +56,15 @@ "minified" : true }, "usingComponents" : true, - "plugins" : {} + "permission" : { + + }, + "plugins" : { + "chooseLocation" : { + "version" : "1.0.10", + "provider" : "wx76a9a06e5b4e693e" + } + } }, "vueVersion" : "2" } diff --git a/mixin/mixin.js b/mixin/mixin.js index f197668..8cf5ae0 100644 --- a/mixin/mixin.js +++ b/mixin/mixin.js @@ -294,6 +294,9 @@ } this.page.total = data.total || 0 + if (this.getList_after) { + this.getList_after() + } } this.$message.hideLoading() } @@ -495,9 +498,9 @@ // #ifdef PUB_CUSTOMER , async submitShopping(dto) { - //提交到购物车中 + //提交到购物车中 this.$message.showLoading() - await this.$store.dispatch('submitShopping',dto); + await this.$store.dispatch('submitShopping', dto); this.$message.hideLoading() } // #endif diff --git a/pages.json b/pages.json index 4accc4b..b6f5b72 100644 --- a/pages.json +++ b/pages.json @@ -32,8 +32,7 @@ { "path": "pages/user/address/address", "style": { - "navigationBarTitleText": "收货地址", - "enablePullDownRefresh": false + "navigationBarTitleText": "收货地址" } }, // #endif @@ -91,6 +90,13 @@ "navigationBarTitleText": "修改密码", "enablePullDownRefresh": false } + }, + { + "path": "pages/help/help", + "style": { + "navigationBarTitleText": "客服中心", + "enablePullDownRefresh": false + } } ], "subPackages": [ diff --git a/pages/help/help.vue b/pages/help/help.vue new file mode 100644 index 0000000..342846f --- /dev/null +++ b/pages/help/help.vue @@ -0,0 +1,17 @@ +<template> + <view> + + </view> +</template> + +<script> +export default { + data() { + return {}; + } +} +</script> + +<style lang="scss"> + +</style> diff --git a/pages/user/address/address.vue b/pages/user/address/address.vue index 75053a7..920a686 100644 --- a/pages/user/address/address.vue +++ b/pages/user/address/address.vue @@ -1,398 +1,481 @@ <template> - <!-- 收获地址列表 --> - <view class="p15 container-address"> - <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> + <!-- 收获地址列表 --> + <view class="p15 container-address"> + <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> - <!-- 循环 --> - <view v-for="(item,index) of list" :key="index" class="location-each"> - <view class="flex"> - <view class="container-info"> - <view class="flex"> - <view class="name">{{item.name || '-'}}</view> - <view class="tel">{{item.tel||'-'}}</view> - </view> - <view class="address"> - {{item.address}} + <!-- 循环 --> + <view v-for="(item,index) of list" :key="index" class="location-each"> + <view class="flex"> + <view class="container-info"> + <view class="flex"> + <view class="name">{{ item.name || '-' }}</view> + <view class="tel">{{ item.tel || '-' }}</view> + </view> + <view class="address"> + {{ item.address }} - </view> - </view> - <!-- <view class="h-line"></view> --> - <view class="edit" @click="()=>{ + </view> + </view> + <!-- <view class="h-line"></view> --> + <view class="edit" @click="()=>{ this.submitForm = { ...item } openAddressForm() }"> - <uni-icons type="compose" class="icon" color="#666666"></uni-icons> - </view> - </view> - <view class="v-line"></view> - <view class="flex"> - <view class="flex" @click="changeDefaultAddress(item,index)"> - <!-- <label class="radio flex" > --> - <!-- <radio value="r1" :checked="item.defaulted" disabled - style="transform:scale(0.6)" v-if="item.defaulted" /> - <radio value="r1" - style="transform:scale(0.6)" :checked="item.defaulted" v-if="!item.defaulted" @change="changeDefaultAddress(item,index)"/> - --> + <uni-icons type="compose" class="icon" color="#666666"></uni-icons> + </view> + </view> + <view class="v-line"></view> + <view class="flex"> + <!-- @click="changeDefaultAddress(item,index)"--> + <view class="flex"> + <view class="radio m-t-2 m-r-10" :class="[item.defaulted?'select':'']"> - <!-- </label> --> - <view class="radio m-t-2 m-r-10" :class="[item.defaulted?'select':'']"> + </view> + <span class="desc">{{ item.defaulted ? '默认地址:' : '当前地址:' }}{{ item.address || '' }}</span> + <!-- 当前地址/默认地址勾选 --> + </view> + <view class="desc del t-red" @click="deleteAddress(item)"> + 删除 + </view> + <view class="desc del t-green m-l-10" v-if="source==='select'" @click="selectAddress(item)"> + 选择此地址 + </view> + </view> - </view> - <span class="desc">{{item.defaulted?'默认地址:':'当前地址:'}}{{item.schoolAreaStr||''}} - {{item.blockStr||''}} - {{item.room||''}}</span> - <!-- 当前地址/默认地址勾选 --> - </view> - <view class="desc del t-red" @click="deleteAddress(item)"> - 删除 - </view> - <view class="desc del t-green m-l-10" v-if="source==='select'" @click="selectAddress(item)"> - 选择此地址 - </view> - </view> - - </view> - <view style="height: 92rpx;width: 690rpx;"> - - </view> - <view class="button-green button-fixed-bottom" style="width: 690rpx;line-height: 92rpx;height: 92rpx;" @click=" ()=>{ + </view> + <view style="height: 92rpx;width: 690rpx;"> + + </view> + <view class="button-green button-fixed-bottom" style="width: 690rpx;line-height: 92rpx;height: 92rpx;" @click=" ()=>{ delete this.submitForm.id this.submitForm['name'] = '' this.submitForm['tel'] = '' this.submitForm['tel'] = '' this.submitForm['area'] = '' - + openAddressForm() - }">添加收货地址</view> + }">添加收货地址 + </view> - <uni-popup ref="popup_form" type="top" :mask-click="false"> - <view class="popup-address-form"> - <view class="close-parent"> - {{submitForm.id?'新增':'编辑'}}收货地址 - <uni-icons class="close" type="closeempty" @click="closeAddressForm"></uni-icons> - </view> - <!--收货人、手机号、校区、详细地址 --> - <view class="submit form"> - <view class="form-item"> - <view class="form-item-label require"> - 收货人 - </view> - <view class="form-item-value"> - <input v-model="submitForm.name" placeholder="请输入收货人" class="form-input"></input> - </view> - </view> - <view class="form-item"> - <view class="form-item-label require"> - 请选择收获地址 - </view> - <view class="form-item-value"> - <input v-model="submitForm.room" placeholder="请选择收获地址" disabled class="form-input"></input> - <!-- todo 点击定位 --> - </view> - </view> - <view class="form-item"> - <view class="form-item-label require"> - 详细地址 - </view> - <view class="form-item-value"> - <input v-model="submitForm.address" placeholder="请输入详细地址" class="form-input"></input> + <uni-popup ref="popup_form" type="top" :mask-click="false"> + <view class="popup-address-form"> + <view class="close-parent"> + {{ submitForm.id ? '新增' : '编辑' }}收货地址 + <uni-icons class="close" type="closeempty" @click="closeAddressForm"></uni-icons> + </view> + <!--收货人、手机号、校区、详细地址 --> + <view class="submit form"> + <view class="form-item"> + <view class="form-item-label require"> + 收货人 + </view> + <view class="form-item-value"> + <input v-model="submitForm.name" placeholder="请输入收货人" class="form-input"></input> + </view> + </view> + <view class="form-item"> + <view class="form-item-label require"> + 请选择收获地址 + </view> + <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> + <uni-data-picker :area="true" @change="(e)=>{PickArea(dto,e)}" placeholder="" + :localdata="regionDataPlus"> + {{ dto['province'] || '请选择' }}{{ dto['city'] && ('/' + dto['city']) || '' }}{{ + dto['region'] && ('/' + dto['region']) || '' + }} + </uni-data-picker> + <u-icon class="m-l-a" name="arrow-right"></u-icon> + </view> - </view> - </view> - <view class="form-item"> - <view class="form-item-label"> - 是否默认 - </view> - <view class="form-item-value"> - <radio value="r1" :checked="submitForm.defaulted" - @click="submitForm.defaulted=!submitForm.defaulted" - style="transform:scale(0.6);margin-top: -8rpx;" /> - </view> - </view> - </view> + <!-- <view class="form-item-value" @click="chooseLocation">--> + <!-- <input v-model="submitForm.room" placeholder="请选择收获地址" disabled class="form-input"></input>--> + <!-- <!– 点击定位 –>--> + <!-- </view>--> + </view> + <view class="form-item"> + <view class="form-item-label require"> + 详细地址 + </view> + <view class="form-item-value"> + <input v-model="submitForm.address" placeholder="请输入详细地址" class="form-input"></input> - <view class="button-green m-t-15" @click="saveOrUpdateAddress">保存</view> - </view> - </uni-popup> + </view> + </view> + <view class="form-item"> + <view class="form-item-label"> + 是否默认 + </view> + <view class="form-item-value"> + <radio value="r1" :checked="submitForm.isDefault" + @click="submitForm.isDefault=!submitForm.isDefault" + style="transform:scale(0.6);margin-top: -8rpx;"/> + </view> + </view> + </view> - </view> + <view class="button-green m-t-15" @click="saveOrUpdateAddress">保存</view> + </view> + </uni-popup> + + </view> </template> <script> - export default { - async onPullDownRefresh() { - this.page.current = 0 - await this.getList() - uni.stopPullDownRefresh() - }, - async onLoad(options) { - // this.list = [{}, {}] - this.source = options.source || '' - this.listApi = '/api/address/customer/list' - await this.getList() +// import qqmapwx from '@/plugins/qqmap-wx-jssdk.min.js'; +// const lockey = 'VUHBZ-2AMLP-B7AD7-VUQZ7-D4TW5-MFFVN'; //使用在腾讯位置服务申请的key +// const chooseLocation = requirePlugin('chooseLocation'); - }, - data() { - return { - source: '', - submitForm: { - name: '', - tel: '', - address: '', - schoolArea: '', - block: '', - room: '', - defaulted: false - }, - }; - }, - methods: { - async changeDefaultAddress(item, index) { - if (item.defaulted) { - return - } - this.$nextTick(() => { - // item.defaulted = false - // this.$set(item,'defaulted',false) - this.$message.confirm('确定设置此地址为默认地址吗').then(async res => { - this.$message.showLoading() - var { - code - } = await this.$http.request('post', '/api/address/customer/default/' + - item.id, {}) - this.$message.hideLoading() - if (code == 0) { - for (var dto of this.list) { - dto.defaulted = false - } - this.$message.showToast('设置成功') - item.defaulted = true - this.$store.commit('setDefaultAddress', { - ...item - }) +export default { + async onPullDownRefresh() { + this.page.current = 0 + await this.getList() + uni.stopPullDownRefresh() + }, + async onLoad(options) { + // this.list = [{}, {}] + this.source = options.source || '' + this.listApi = '/api/address/list' + await this.getList() - } - }, err => { - this.$nextTick(() => { - this.list[index].defaulted = false - this.$forceUpdate() - console.log('err', err, this.list[index]) - }) + }, + data() { + return { + source: '', + submitForm: { + name: '', + tel: '', + address: '', + isDefault: false, + province: '', + city: '', + region: '', + + }, + regionDataPlus: [], + }; + }, + methods: { + PickArea(item, e) { + console.log('PickArea', item, e) + if (e.detail.value) { + this.dto.province = '' + this.dto.city = '' + this.dto.region = '' + if (e.detail.value.length <= 3) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.city = e.detail.value[1].value + if (!!e.detail.value[2]) + this.dto.region = e.detail.value[2].value + } else { + //说明有重复的 + var plusnum = e.detail.value.length - 3 + if (!!e.detail.value[plusnum + 0]) + this.dto.province = e.detail.value[plusnum + 0].value + if (!!e.detail.value[plusnum + 1]) + this.dto.city = e.detail.value[plusnum + 1].value + if (!!e.detail.value[plusnum + 2]) + this.dto.region = e.detail.value[plusnum + 2].value + } + + this.$forceUpdate() + + } + }, + async init_area() { + const res = await this.$http.request('get', '/api/pub/china/area/json') + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', + 'text')) || [] + }, + chooseLocation() { + //前往接口挑选位置 + const qqmapsdk = new qqmapwx({ + // 使用你在腾讯地图应用生成的key + key: lockey + }); + + uni.getLocation({ + type: 'wgs84', + success(res) { + //得到经纬度 + console.log(res); + qqmapsdk.reverseGeocoder({ + location: { + latitude: res.latitude, + longitude: res.longitude + }, + //成功后的回调 + success: (r) => { + // console.log('地址信息', r.result.address_component); + // result: {location: {lat: 31.26249, lng: 120.63212}, address: "江苏省苏州市吴中区太湖东路288号",…} + // ad_info: {nation_code: "156", adcode: "320506", phone_area_code: "0512", city_code: "156320500",…} + // address: "江苏省苏州市吴中区太湖东路288号" + // address_component: {nation: "中国", province: "江苏省", city: "苏州市", district: "吴中区", street: "太湖东路",…} + // address_reference: {,…} + // formatted_addresses: {recommend: "长桥苏州市吴中区人民政府(太湖东路北)", rough: "长桥苏州市吴中区人民政府(太湖东路北)"} + // location: {lat: 31.26249, lng: 120.63212} + // status: 0 + tmp.formcodes['LOC_ONE'][tmp.tmp_picker_lock_index].longitude = r + .result.location.lng + tmp.formcodes['LOC_ONE'][tmp.tmp_picker_lock_index].latitude = r + .result.location.lat + tmp.formcodes['LOC_ONE'][tmp.tmp_picker_lock_index].loc_desc = r + .result.address + tmp.formcodes['LOC_ONE'][tmp.tmp_picker_lock_index]._show = false + tmp.$forceUpdate() + tmp.tmp_picker_lock_index = -1 + + }, + fail: function (res) { + console.log(res); + tmp.tmp_picker_lock_index = -1 + }, + }); + } + }); + }, + async changeDefaultAddress(item, index) { + if (item.isDefault) { + return + } + this.$nextTick(() => { + + this.$message.confirm('确定设置此地址为默认地址吗').then(async res => { + this.$message.showLoading() + var { + code + } = await this.$http.request('post', '/api/address/customer/default/' + + item.id, {}) + this.$message.hideLoading() + if (code === 0) { + for (var dto of this.list) { + dto.isDefault = false + } + this.$message.showToast('设置成功') + item.isDefault = true + this.$store.commit('setDefaultAddress', { + ...item + }) + + } + }, err => { + this.$nextTick(() => { + this.list[index].defaulted = false + this.$forceUpdate() + console.log('err', err, this.list[index]) + }) - }) - }) - }, - async selectAddress(item) { - await this.$message.confirm('确定选择此地址作为收获地址吗') - //携带,然后返回 - this.$store.commit('setDefaultAddress', { - ...item - }) - this.backpage() - }, - async deleteAddress(item) { - await this.$message.confirm('确定删除此地址吗') - this.$message.showLoading() - var { - code - } = await this.$http.request('get', '/api/address/customer/delete/' + item.id, {}) - this.$message.hideLoading() - if (code == 0) { - this.$message.showToast('删除成功') - setTimeout(() => { - this.page.current = 1 - this.getList() - }, 500) - } - }, - async openAddressForm() { - if (this.submitForm.id) { - this.$message.showLoading() - var { - data - } = await this.$http.request('get', '/api/address/customer/get/' + this.submitForm.id, {}) + }) + }) + }, + async selectAddress(item) { + await this.$message.confirm('确定选择此地址作为收获地址吗') + //携带,然后返回 + this.$store.commit('setDefaultAddress', { + ...item + }) + this.backpage() + }, + async deleteAddress(item) { + await this.$message.confirm('确定删除此地址吗') + this.$message.showLoading() + var { + code + } = await this.$http.request('get', '/api/address/customer/delete/' + item.id, {}) + this.$message.hideLoading() + if (code === 0) { + this.$message.showToast('删除成功') + setTimeout(() => { + this.page.current = 1 + this.getList() + }, 500) + } + }, + async openAddressForm() { + this.init_area() + if (this.submitForm.id) { + this.$message.showLoading() + var { + data + } = await this.$http.request('get', '/api/address/list/detail/' + this.submitForm.id, {}) - if (data) { - this.submitForm = { - ...this.submitForm, - ...data - } - this.blockIndex = -1 - this.schoolIndex = -1 - } - this.$message.hideLoading() - } else { - this.submitForm = { - name: this.currentInfo && this.currentInfo.nickName || '', - tel: this.currentInfo && this.currentInfo.tel || '', - address: '', - schoolArea: '', - block: '', - room: '', - defaulted: false - } - this.schoolIndex = -1 - this.blockIndex = -1 - this.blocks = [] - } + if (data) { + this.submitForm = { + ...this.submitForm, + ...data + } + } + this.$message.hideLoading() + } else { + this.submitForm = { + name: this.currentInfo && this.currentInfo.nickName || '', + tel: this.currentInfo && this.currentInfo.tel || '', + address: '', + isDefault: false, + province: '', + city: '', + region: '', + } + } - this.$refs.popup_form.open() + this.$refs.popup_form.open() - }, - closeAddressForm() { - this.$refs.popup_form.close() + }, + closeAddressForm() { + this.$refs.popup_form.close() - }, - async saveOrUpdateAddress() { - if (!this.checkFormValues(this.submitForm, ['tel', 'name', 'address'])) { - this.$message.showToast('字段未填写完整') - return - } - this.$message.showLoading() - const { - code - } = await this.$http.request('post', '/api/address/customer/' + (this.submitForm.id ? 'edit' : - 'new'), { - data: this.submitForm - }) - this.$message.hideLoading() - if (code == 0) { - this.$refs.popup_form.close() - this.$message.showToast(this.submitForm.id ? '修改成功' : '新增成功') + }, + async saveOrUpdateAddress() { + if (!this.checkFormValues(this.submitForm, ['tel', 'name', 'address'])) { + this.$message.showToast('字段未填写完整') + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/address/' + (this.submitForm.id ? 'update' : + 'edit'), { + data: this.submitForm + }) + this.$message.hideLoading() + if (code === 0) { + this.$refs.popup_form.close() + this.$message.showToast(this.submitForm.id ? '修改成功' : '新增成功') - setTimeout(() => { - this.page.current = 1 - this.getList() - }, 300) - } - }, + setTimeout(() => { + this.page.current = 1 + this.getList() + }, 300) + } + }, - } - } + } +} </script> <style lang="scss" scoped> - .container-address { - .popup-address-form { - background: #FFFFFF; - border-radius: 16rpx; - // width: 690rpx; - height: 882rpx; - margin-top: 120rpx; - margin-left: 30rpx; - margin-right: 30rpx; - padding: 24rpx 36rpx; +.container-address { + .popup-address-form { + background: #FFFFFF; + border-radius: 16rpx; + // width: 690rpx; + height: 882rpx; + margin-top: 120rpx; + margin-left: 30rpx; + margin-right: 30rpx; + padding: 24rpx 36rpx; - .submit { - margin-top: 30rpx; + .submit { + margin-top: 30rpx; - .form-input { - height: 36rpx; - line-height: 36rpx; - } - } - } + .form-input { + height: 36rpx; + line-height: 36rpx; + } + } + } - .location-each { - background: #FFFFFF; - border-radius: 16rpx; - margin-bottom: 24rpx; - padding: 36rpx; + .location-each { + background: #FFFFFF; + border-radius: 16rpx; + margin-bottom: 24rpx; + padding: 36rpx; - .name { - font-size: 32rpx; - color: #000000; - line-height: 44rpx; - text-align: left; - font-style: normal; - } + .name { + font-size: 32rpx; + color: #000000; + line-height: 44rpx; + text-align: left; + font-style: normal; + } - .tel { - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - text-align: left; - font-style: normal; - padding-top: 4rpx; - margin-left: 20rpx; - } + .tel { + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + text-align: left; + font-style: normal; + padding-top: 4rpx; + margin-left: 20rpx; + } - .address { - font-size: 24rpx; - color: #000000; - line-height: 34rpx; - text-align: left; - font-style: normal; - } + .address { + font-size: 24rpx; + color: #000000; + line-height: 34rpx; + text-align: left; + font-style: normal; + } - .desc { - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - text-align: left; - font-style: normal; - } + .desc { + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + text-align: left; + font-style: normal; + } - .del { - // vertical-align: baseline; - margin-left: auto; - margin-right: 6rpx; - margin-top: 4rpx; - } + .del { + // vertical-align: baseline; + margin-left: auto; + margin-right: 6rpx; + margin-top: 4rpx; + } - .container-info { - max-width: 540rpx; - } + .container-info { + max-width: 540rpx; + } - .h-line { - width: 2rpx; - height: 46rpx; - background-color: #EEEEEE; - margin-left: 28rpx; - margin-right: 24rpx; - } + .h-line { + width: 2rpx; + height: 46rpx; + background-color: #EEEEEE; + margin-left: 28rpx; + margin-right: 24rpx; + } - .v-line { - width: 638rpx; - height: 2rpx; - // border: 2rpx solid #EEEEEE; - background-color: #EEEEEE; - margin-top: 24rpx; - margin-bottom: 24rpx; - } + .v-line { + width: 638rpx; + height: 2rpx; + // border: 2rpx solid #EEEEEE; + background-color: #EEEEEE; + margin-top: 24rpx; + margin-bottom: 24rpx; + } - .edit { - // min-width: 80rpx; - width: fit-content; - margin-left: auto; - margin-right: 0rpx; - display: flex; - position: relative; + .edit { + // min-width: 80rpx; + width: fit-content; + margin-left: auto; + margin-right: 0rpx; + display: flex; + position: relative; - .icon { - // margin: 0 auto; - // mar - margin-left: auto; - margin-right: auto; - margin-top: 20rpx; - display: block; + .icon { + // margin: 0 auto; + // mar + margin-left: auto; + margin-right: auto; + margin-top: 20rpx; + display: block; - } - } + } + } - .edit::before { - content: " "; - width: 2rpx; - height: 46rpx; - background-color: #EEEEEE; - position: absolute; - left: -24rpx; - top: 20rpx; - } - } - } + .edit::before { + content: " "; + width: 2rpx; + height: 46rpx; + background-color: #EEEEEE; + position: absolute; + left: -24rpx; + top: 20rpx; + } + } +} </style> \ No newline at end of file diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index 3d59935..24e8762 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -1,299 +1,320 @@ <template> - <view class="main-container user-container"> - <!-- <view> - 我的 - </view> --> - <!-- 背景图 --> - <view class="top-bg img100 relative" :style="{'padding-top':(StatusBar)+'px','line-height':CustomBar+'rpx' }"> - <image class="component-bg" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/21/21c95c14e9504be69edff7785e3b44a9bg.png" - mode="scaleToFill" /> + <view class="main-container user-container"> + <!-- <view> + 我的 + </view> --> + <!-- 背景图 --> + <view class="top-bg img100 relative" :style="{'padding-top':(StatusBar)+'px','line-height':CustomBar+'rpx' }"> + <image class="component-bg" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/21/21c95c14e9504be69edff7785e3b44a9bg.png" + mode="scaleToFill"/> - <view class="title" style="position: relative;"> - 个人中心 + <view class="title" style="position: relative;"> + 个人中心 - </view> - <!-- v-if="currentInfo&&(currentInfo.id)" --> - <view class="flex user-info"> - <!-- 头像 --> - <image class="user-icon" v-if="!currentInfo.picture" src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' - mode="aspectFit"></image> - <image class="user-icon" v-if="currentInfo.picture" :src="currentInfo.picture" mode="aspectFit"></image> + </view> + <!-- v-if="currentInfo&&(currentInfo.id)" --> + <view class="flex user-info"> + <!-- 头像 --> + <image class="user-icon" v-if="!currentInfo.picture" + src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' + mode="aspectFit"></image> + <image class="user-icon" v-if="currentInfo.picture" :src="currentInfo.picture" mode="aspectFit"></image> - - <view class="name" v-if="currentInfo.id"> - <view class="t1" > - {{ (!!currentInfo.supplierDTO?(currentInfo.supplierDTO.name):"") || currentInfo.nickName || currentInfo.loginName || '-'}}<span - v-if="currentInfo.supplierDTO&¤tInfo.supplierDTO.status!=='P'"> - ({{currentInfo.supplierDTO?currentInfo.supplierDTO.statusStr:''}})</span> - </view> - <view class="t2">{{currentInfo.tel || '暂无电话'}}</view> - </view> - <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="getUserProfile" style="font-size: 48rpx;margin-top: 16rpx;"> - {{'点击登陆'}} - </view> - <image class="icon-setting" src="../../static/common/icon-setting.png" mode="aspectFit"></image> - </view> - <!-- #ifdef PUB_CUSTOMER --> - <view class="customer-info-records"> - <view class="item"> - <view class="num">59</view> - <view class="name">我的收藏</view> - </view> - <view class="line"></view> - <view class="item"> - <view class="num">5</view> - <view class="name">关注店铺</view> - </view> - <view class="line"></view> - <view class="item"> - <view class="num">87</view> - <view class="name">浏览记录</view> - </view> - </view> - <!-- #endif --> + <view class="name" v-if="currentInfo.id"> + <view class="t1"> + {{ + (!!currentInfo.supplierDTO ? (currentInfo.supplierDTO.name) : "") || currentInfo.nickName || currentInfo.loginName || '-' + }}<span + v-if="currentInfo.supplierDTO&¤tInfo.supplierDTO.status!=='P'"> + ({{ currentInfo.supplierDTO ? currentInfo.supplierDTO.statusStr : '' }})</span> + </view> + <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view> + </view> + <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="getUserProfile" + style="font-size: 48rpx;margin-top: 16rpx;"> + {{ '点击登陆' }} + </view> + <image class="icon-setting" src="../../static/common/icon-setting.png" mode="aspectFit"></image> + </view> + <!-- #ifdef PUB_CUSTOMER --> + <view class="customer-info-records"> + <view class="item"> + <view class="num">{{ tj.collectNum || 0 }}</view> + <view class="name">我的收藏</view> + </view> + <view class="line"></view> + <view class="item"> + <view class="num">{{ tj.followNum || 0 }}</view> + <view class="name">关注店铺</view> + </view> + <view class="line"></view> + <view class="item"> + <view class="num">{{ tj.browseNum || 0 }}</view> + <view class="name">浏览记录</view> + </view> + </view> + <!-- #endif --> - </view> - <!-- #ifdef PUB_CUSTOMER --> - <view class="user-utils m-20 user-customer-order-infos" v-if="selftype==='customer'||!selftype"> - <view class="user-util m-t-12"> - <view class="title flex"> - <view class="flex1">我的订单</view> - <view class="m-r-a m-r-0 more">全部订单<uni-icons class="" type="right" - size="12"></uni-icons></view> - </view> - <view class="flex order-icons-container"> - <view class="order-icons"> - <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk"></image> - <view>待付款</view> - </view> - <view class="order-icons"> - <image src="../../static/images/customer/order/order-type-2.png" class="order-icon dfh"></image> - <view>待发货</view> - </view> - <view class="order-icons"> - <image src="../../static/images/customer/order/order-type-3.png" class="order-icon dsh"></image> - <view>待收货</view> - </view> - <view class="order-icons"> - <image src="../../static/images/customer/order/order-type-4.png" class="order-icon dpj"></image> - <view>待评价</view> - </view> - <view class="order-icons"> - <image src="../../static/images/customer/order/order-type-5.png" class="order-icon sh"></image> - <view>售后</view> - </view> - </view> - </view> - </view> - <view class="user-utils m-20" v-if="selftype==='customer'||!selftype"> - <view class="user-util m-t-12 user-customer-service-infos"> - <view class="title flex"> - <view>我的服务</view> - </view> - <view class="flex service-icons-container"> - <view class="service-icons"> - <image src="../../static/images/customer/service/service-icon-1.png" class="service-icon "> - </image> - <view>关注店铺</view> - </view> - <view class="service-icons"> - <image src="../../static/images/customer/service/service-icon-2.png" class="service-icon "> - </image> - <view>我的收藏</view> - </view> - <view class="service-icons" @click="goto('/pages/user/address/address',true)"> - <image src="../../static/images/customer/service/service-icon-3.png" class="service-icon "> - </image> - <view>地址管理</view> - </view> - <view class="service-icons"> - <image src="../../static/images/customer/service/service-icon-4.png" class="service-icon "> - </image> - <view>售后规则</view> - </view> - </view> - <view class="flex service-icons-container"> - <view class="service-icons"> - <image src="../../static/images/customer/service/service-icon-5.png" class="t2 service-icon "> - </image> - <view>新手帮助</view> - </view> - <view class="service-icons"> - <image src="../../static/images/customer/service/service-icon-6.png" class="t2 service-icon "> - </image> - <view>运费详查</view> - </view> - <view class="service-icons"></view> - <view class="service-icons"></view> - </view> - </view> - </view> - <!-- #endif --> - <view class="user-utils m-20"> - <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-info/user-info',true)"> - <view class="title">个人信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 flex" v-if="selftype==='partner'" - @click="goto('/sub_pages/partner/partner-info/partner-info',true)"> - <view class="title">合伙人信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 flex" v-if="selftype==='supplier'" - @click="goto('/sub_pages/supplier/supplier-info/supplier-info',true)"> - <view class="title">店铺信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-pwd/user-pwd',true)"> - <view class="title">修改密码</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 " @click="callTel" - v-if="selftype==='supplier'||selftype==='customer' || !selftype"> - <view class="title">我的客服</view> - <view class="flex"> - <image class="icon-clock m-r-6 m-t-2" src="../../static/common/icon-call.png"></image> - <view class="name"> - 客服电话 : <span class="topic-gray">{{tel}}</span> - </view> - </view> - </view> - <!-- <view class="user-util m-t-12 " @click="callTel" v-if="selftype==='partner'"> - <view class="name"> - 账号: <span class="topic-gray">{{tel}}</span> - </view> - <view class="name"> - 密码: <span class="topic-gray">{{tel}}</span> - </view> - </view> --> - </view> + </view> + <!-- #ifdef PUB_CUSTOMER --> + <view class="user-utils m-20 user-customer-order-infos" v-if="selftype==='customer'||!selftype"> + <view class="user-util m-t-12"> + <view class="title flex"> + <view class="flex1">我的订单</view> + <view class="m-r-a m-r-0 more">全部订单 + <uni-icons class="" type="right" + size="12"></uni-icons> + </view> + </view> + <view class="flex order-icons-container"> + <view class="order-icons"> + <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk"></image> + <view>待付款</view> + </view> + <view class="order-icons"> + <image src="../../static/images/customer/order/order-type-2.png" class="order-icon dfh"></image> + <view>待发货</view> + </view> + <view class="order-icons"> + <image src="../../static/images/customer/order/order-type-3.png" class="order-icon dsh"></image> + <view>待收货</view> + </view> + <view class="order-icons"> + <image src="../../static/images/customer/order/order-type-4.png" class="order-icon dpj"></image> + <view>待评价</view> + </view> + <view class="order-icons"> + <image src="../../static/images/customer/order/order-type-5.png" class="order-icon sh"></image> + <view>售后</view> + </view> + </view> + </view> + </view> + <view class="user-utils m-20" v-if="selftype==='customer'||!selftype"> + <view class="user-util m-t-12 user-customer-service-infos"> + <view class="title flex"> + <view>我的服务</view> + </view> + <view class="flex service-icons-container"> + <view class="service-icons" @click="goto('/sub_pages/customer/follow/follow',true)"> + <image src="../../static/images/customer/service/service-icon-1.png" class="service-icon "> + </image> + <view>关注店铺</view> + </view> + <view class="service-icons" @click="goto('/sub_pages/customer/collect/collect',true)"> + <image src="../../static/images/customer/service/service-icon-2.png" class="service-icon "> + </image> + <view>我的收藏</view> + </view> + <view class="service-icons" @click="goto('/pages/user/address/address',true)"> + <image src="../../static/images/customer/service/service-icon-3.png" class="service-icon "> + </image> + <view>地址管理</view> + </view> + <view class="service-icons"> + <image src="../../static/images/customer/service/service-icon-4.png" class="service-icon "> + </image> + <view>售后规则</view> + </view> + </view> + <view class="flex service-icons-container"> + <view class="service-icons"> + <image src="../../static/images/customer/service/service-icon-5.png" class="t2 service-icon "> + </image> + <view>新手帮助</view> + </view> + <view class="service-icons"> + <image src="../../static/images/customer/service/service-icon-6.png" class="t2 service-icon "> + </image> + <view>运费详查</view> + </view> + <view class="service-icons"></view> + <view class="service-icons"></view> + </view> + </view> + </view> + <!-- #endif --> + <view class="user-utils m-20"> + <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-info/user-info',true)"> + <view class="title">个人信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 flex" v-if="selftype==='partner'" + @click="goto('/sub_pages/partner/partner-info/partner-info',true)"> + <view class="title">合伙人信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 flex" v-if="selftype==='supplier'" + @click="goto('/sub_pages/supplier/supplier-info/supplier-info',true)"> + <view class="title">店铺信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-pwd/user-pwd',true)"> + <view class="title">修改密码</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 " @click="callTel" + v-if="selftype==='supplier'||selftype==='customer' || !selftype"> + <view class="title">我的客服</view> + <view class="flex"> + <image class="icon-clock m-r-6 m-t-2" src="../../static/common/icon-call.png"></image> + <view class="name"> + 客服电话 : <span class="topic-gray">{{ tel }}</span> + </view> + <view class="right-icon" @click="goto('/pages/help/help',false)"> + <uni-icons type="right"></uni-icons> + </view> + </view> + </view> + <!-- <view class="user-util m-t-12 " @click="callTel" v-if="selftype==='partner'"> + <view class="name"> + 账号: <span class="topic-gray">{{tel}}</span> + </view> + <view class="name"> + 密码: <span class="topic-gray">{{tel}}</span> + </view> + </view> --> + </view> + <!-- #ifdef PUB_CUSTOMER --> + <view style="padding-bottom:200rpx"> + </view> + <common-footer flg="3"></common-footer> - <!-- #ifdef PUB_CUSTOMER --> - <view style="padding-bottom:200rpx"> - </view> - <common-footer flg="3"></common-footer> - - <uni-popup ref="popup_info" type="bottom"> - <view class="popup-form"> - - <view class="infocontainar"> - <cu-custom bgColor="none" :isBack="false"> - <block slot="content"><span style="color: #333;font-weight: 400;">获取用户头像、昵称</span></block> - </cu-custom> - - - <view class="avatarUrl"> - <button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"> - <image :src="regAvatarUrl" class="refreshIcon"></image> - </button> - </view> - <view class="userName"> - <text style="padding-bottom: 20rpx;">修改昵称:</text> - <input :clearable="false" type="nickname" class="weui-input" :value="regUserName" @blur="onBindblur" - placeholder="请输入昵称" @input="onBindinput" /> - </view> - - <view style="width: 100%;height: 1px; background: #EEE;"> - - </view> - <view style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; margin-top: 40rpx;"> - · 申请获取以下权限 - </view> - <view - style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; color: #cbcbcb; margin-top: 25rpx;"> - · 获得你的信息(昵称、头像等) - </view> - - <view class="btn"> - <view @click="onWxCheckSubmit" class="button-green">保存</view> - </view> - - </view> - </view> - </uni-popup> - - - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER --> - <view class="button-login-out topic-gray" @click="clearlogout"> - 退出登录 - </view> + <uni-popup ref="popup_info" type="bottom"> + <view class="popup-form"> - <view style="padding-bottom:200rpx"> - </view> - <common-footer flg="1"></common-footer> - <!-- #endif --> + <view class="infocontainar"> + <cu-custom bgColor="none" :isBack="false"> + <block slot="content"><span style="color: #333;font-weight: 400;">获取用户头像、昵称</span></block> + </cu-custom> + <view class="avatarUrl"> + <button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"> + <image :src="regAvatarUrl" class="refreshIcon"></image> + </button> + </view> + <view class="userName"> + <text style="padding-bottom: 20rpx;">修改昵称:</text> + <input :clearable="false" type="nickname" class="weui-input" :value="regUserName" @blur="onBindblur" + placeholder="请输入昵称" @input="onBindinput"/> + </view> - </view> + <view style="width: 100%;height: 1px; background: #EEE;"> + + </view> + <view style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; margin-top: 40rpx;"> + · 申请获取以下权限 + </view> + <view + style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; color: #cbcbcb; margin-top: 25rpx;"> + · 获得你的信息(昵称、头像等) + </view> + + <view class="btn"> + <view @click="onWxCheckSubmit" class="button-green">保存</view> + </view> + + </view> + </view> + </uni-popup> + + + <!-- #endif --> + <!-- #ifndef PUB_CUSTOMER --> + <view class="button-login-out topic-gray" @click="clearlogout"> + 退出登录 + </view> + + <view style="padding-bottom:200rpx"> + </view> + <common-footer flg="1"></common-footer> + <!-- #endif --> + + + </view> </template> <script> - export default { - data() { - return { - CustomBar: uni.getStorageSync('CustomBar'), - StatusBar: uni.getStorageSync('StatusBar'), - tcode: '', - inviterName: '', - // StatusBar:0, - tel: '15974805814' - }; - }, +export default { + data() { + return { + CustomBar: uni.getStorageSync('CustomBar'), + StatusBar: uni.getStorageSync('StatusBar'), + tcode: '', + inviterName: '', + // StatusBar:0, + tel: '15974805814', + tj: {}, + }; + }, - onLoad(options) { - const url = options.q ? decodeURIComponent(options.q) : ''; - const urlcode = options.url && decodeURIComponent(options.url) || '' - }, - created() { + onLoad(options) { + // const url = options.q ? decodeURIComponent(options.q) : ''; + // const urlcode = options.url && decodeURIComponent(options.url) || '' - }, - async onPullDownRefresh() { - await this.$store.dispatch('getCurrentInfo') - uni.stopPullDownRefresh() - }, - methods: { + // #ifdef PUB_CUSTOMER + if (this.currentInfo.id) { + let that = this + setTimeout(() => { + this.$http.request('get', '/api/customer/center/tj', {}).then(res => { + if (res.code === 0) { + that.tj = res.data || {} + } + }) + }, 200) + } + // #endif - async clearlogout() { - await this.$message.confirm('是否退出登录?') - this.$store.commit('updateLogin', false) + }, + created() { - uni.reLaunch({ - url: '/pages/login/supplier-login' - }) - }, - async callTel() { - await this.$message.confirm('是否拨打客服电话') - uni.makePhoneCall({ - phoneNumber: this.tel //仅为示例 - }); - } + }, + async onPullDownRefresh() { + await this.$store.dispatch('getCurrentInfo') + uni.stopPullDownRefresh() + }, + methods: { + + async clearlogout() { + await this.$message.confirm('是否退出登录?') + this.$store.commit('updateLogin', false) + + uni.reLaunch({ + url: '/pages/login/supplier-login' + }) + }, + async callTel() { + await this.$message.confirm('是否拨打客服电话') + uni.makePhoneCall({ + phoneNumber: this.tel //仅为示例 + }); + } - } - } + } +} </script> <style lang="scss" scoped> - @import "./user.scss"; +@import "./user.scss"; </style> <!-- #ifdef PUB_CUSTOMER --> <style lang="scss" scoped> - @import "./user-customer.scss"; +@import "./user-customer.scss"; </style> <!-- #endif --> <style lang="scss" scoped> diff --git a/plugins/qqmap-wx-jssdk.min.js b/plugins/qqmap-wx-jssdk.min.js new file mode 100644 index 0000000..8fa1477 --- /dev/null +++ b/plugins/qqmap-wx-jssdk.min.js @@ -0,0 +1 @@ +var ERROR_CONF = { KEY_ERR: 311, KEY_ERR_MSG: 'key格式错误', PARAM_ERR: 310, PARAM_ERR_MSG: '请求参数信息有误', SYSTEM_ERR: 600, SYSTEM_ERR_MSG: '系统错误', WX_ERR_CODE: 1000, WX_OK_CODE: 200 }; var BASE_URL = 'https://apis.map.qq.com/ws/'; var URL_SEARCH = BASE_URL + 'place/v1/search'; var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; var URL_CITY_LIST = BASE_URL + 'district/v1/list'; var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; var URL_DISTANCE = BASE_URL + 'distance/v1/'; var URL_DIRECTION = BASE_URL + 'direction/v1/'; var MODE = { driving: 'driving', transit: 'transit' }; var EARTH_RADIUS = 6378136.49; var Utils = { safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xffff) }, bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) }, md5cmn(q, a, b, x, s, t) { return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b) }, md5ff(a, b, c, d, x, s, t) { return this.md5cmn((b & c) | (~b & d), a, b, x, s, t) }, md5gg(a, b, c, d, x, s, t) { return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t) }, md5hh(a, b, c, d, x, s, t) { return this.md5cmn(b ^ c ^ d, a, b, x, s, t) }, md5ii(a, b, c, d, x, s, t) { return this.md5cmn(c ^ (b | ~d), a, b, x, s, t) }, binlMD5(x, len) { x[len >> 5] |= 0x80 << (len % 32); x[((len + 64) >>> 9 << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = this.md5ff(a, b, c, d, x[i], 7, -680876936); d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063); b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = this.md5gg(b, c, d, a, x[i], 20, -373897302); a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558); d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = this.md5hh(d, a, b, c, x[i], 11, -358537222); c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = this.md5ii(a, b, c, d, x[i], 6, -198630844); d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = this.safeAdd(a, olda); b = this.safeAdd(b, oldb); c = this.safeAdd(c, oldc); d = this.safeAdd(d, oldd) } return [a, b, c, d] }, binl2rstr(input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) } return output }, rstr2binl(input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) } return output }, rstrMD5(s) { return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8)) }, rstrHMACMD5(key, data) { var i; var bkey = this.rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = this.binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128)) }, rstr2hex(input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output }, str2rstrUTF8(input) { return unescape(encodeURIComponent(input)) }, rawMD5(s) { return this.rstrMD5(this.str2rstrUTF8(s)) }, hexMD5(s) { return this.rstr2hex(this.rawMD5(s)) }, rawHMACMD5(k, d) { return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d)) }, hexHMACMD5(k, d) { return this.rstr2hex(this.rawHMACMD5(k, d)) }, md5(string, key, raw) { if (!key) { if (!raw) { return this.hexMD5(string) } return this.rawMD5(string) } if (!raw) { return this.hexHMACMD5(key, string) } return this.rawHMACMD5(key, string) }, getSig(requestParam, sk, feature, mode) { var sig = null; var requestArr = []; Object.keys(requestParam).sort().forEach(function (key) { requestArr.push(key + '=' + requestParam[key]) }); if (feature == 'search') { sig = '/ws/place/v1/search?' + requestArr.join('&') + sk } if (feature == 'suggest') { sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk } if (feature == 'reverseGeocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'geocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'getCityList') { sig = '/ws/district/v1/list?' + requestArr.join('&') + sk } if (feature == 'getDistrictByCityId') { sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk } if (feature == 'calculateDistance') { sig = '/ws/distance/v1/?' + requestArr.join('&') + sk } if (feature == 'direction') { sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk } sig = this.md5(sig); return sig }, location2query(data) { if (typeof data == 'string') { return data } var query = ''; for (var i = 0; i < data.length; i++) { var d = data[i]; if (!!query) { query += ';' } if (d.location) { query = query + d.location.lat + ',' + d.location.lng } if (d.latitude && d.longitude) { query = query + d.latitude + ',' + d.longitude } } return query }, rad(d) { return d * Math.PI / 180.0 }, getEndLocation(location) { var to = location.split(';'); var endLocation = []; for (var i = 0; i < to.length; i++) { endLocation.push({ lat: parseFloat(to[i].split(',')[0]), lng: parseFloat(to[i].split(',')[1]) }) } return endLocation }, getDistance(latFrom, lngFrom, latTo, lngTo) { var radLatFrom = this.rad(latFrom); var radLatTo = this.rad(latTo); var a = radLatFrom - radLatTo; var b = this.rad(lngFrom) - this.rad(lngTo); var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); distance = distance * EARTH_RADIUS; distance = Math.round(distance * 10000) / 10000; return parseFloat(distance.toFixed(0)) }, getWXLocation(success, fail, complete) { wx.getLocation({ type: 'gcj02', success: success, fail: fail, complete: complete }) }, getLocationParam(location) { if (typeof location == 'string') { var locationArr = location.split(','); if (locationArr.length === 2) { location = { latitude: location.split(',')[0], longitude: location.split(',')[1] } } else { location = {} } } return location }, polyfillParam(param) { param.success = param.success || function () { }; param.fail = param.fail || function () { }; param.complete = param.complete || function () { } }, checkParamKeyEmpty(param, key) { if (!param[key]) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误'); param.fail(errconf); param.complete(errconf); return true } return false }, checkKeyword(param) { return !this.checkParamKeyEmpty(param, 'keyword') }, checkLocation(param) { var location = this.getLocationParam(param.location); if (!location || !location.latitude || !location.longitude) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); param.fail(errconf); param.complete(errconf); return false } return true }, buildErrorConfig(errCode, errMsg) { return { status: errCode, message: errMsg } }, handleData(param, data, feature) { if (feature == 'search') { var searchResult = data.data; var searchSimplify = []; for (var i = 0; i < searchResult.length; i++) { searchSimplify.push({ id: searchResult[i].id || null, title: searchResult[i].title || null, latitude: searchResult[i].location && searchResult[i].location.lat || null, longitude: searchResult[i].location && searchResult[i].location.lng || null, address: searchResult[i].address || null, category: searchResult[i].category || null, tel: searchResult[i].tel || null, adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, province: searchResult[i].ad_info && searchResult[i].ad_info.province || null }) } param.success(data, { searchResult: searchResult, searchSimplify: searchSimplify }) } else if (feature == 'suggest') { var suggestResult = data.data; var suggestSimplify = []; for (var i = 0; i < suggestResult.length; i++) { suggestSimplify.push({ adcode: suggestResult[i].adcode || null, address: suggestResult[i].address || null, category: suggestResult[i].category || null, city: suggestResult[i].city || null, district: suggestResult[i].district || null, id: suggestResult[i].id || null, latitude: suggestResult[i].location && suggestResult[i].location.lat || null, longitude: suggestResult[i].location && suggestResult[i].location.lng || null, province: suggestResult[i].province || null, title: suggestResult[i].title || null, type: suggestResult[i].type || null }) } param.success(data, { suggestResult: suggestResult, suggestSimplify: suggestSimplify }) } else if (feature == 'reverseGeocoder') { var reverseGeocoderResult = data.result; var reverseGeocoderSimplify = { address: reverseGeocoderResult.address || null, latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null }; if (reverseGeocoderResult.pois) { var pois = reverseGeocoderResult.pois; var poisSimplify = []; for (var i = 0; i < pois.length; i++) { poisSimplify.push({ id: pois[i].id || null, title: pois[i].title || null, latitude: pois[i].location && pois[i].location.lat || null, longitude: pois[i].location && pois[i].location.lng || null, address: pois[i].address || null, category: pois[i].category || null, adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, city: pois[i].ad_info && pois[i].ad_info.city || null, district: pois[i].ad_info && pois[i].ad_info.district || null, province: pois[i].ad_info && pois[i].ad_info.province || null }) } param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify, pois: pois, poisSimplify: poisSimplify }) } else { param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify }) } } else if (feature == 'geocoder') { var geocoderResult = data.result; var geocoderSimplify = { title: geocoderResult.title || null, latitude: geocoderResult.location && geocoderResult.location.lat || null, longitude: geocoderResult.location && geocoderResult.location.lng || null, adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, province: geocoderResult.address_components && geocoderResult.address_components.province || null, city: geocoderResult.address_components && geocoderResult.address_components.city || null, district: geocoderResult.address_components && geocoderResult.address_components.district || null, street: geocoderResult.address_components && geocoderResult.address_components.street || null, street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, level: geocoderResult.level || null }; param.success(data, { geocoderResult: geocoderResult, geocoderSimplify: geocoderSimplify }) } else if (feature == 'getCityList') { var provinceResult = data.result[0]; var cityResult = data.result[1]; var districtResult = data.result[2]; param.success(data, { provinceResult: provinceResult, cityResult: cityResult, districtResult: districtResult }) } else if (feature == 'getDistrictByCityId') { var districtByCity = data.result[0]; param.success(data, districtByCity) } else if (feature == 'calculateDistance') { var calculateDistanceResult = data.result.elements; var distance = []; for (var i = 0; i < calculateDistanceResult.length; i++) { distance.push(calculateDistanceResult[i].distance) } param.success(data, { calculateDistanceResult: calculateDistanceResult, distance: distance }) } else if (feature == 'direction') { var direction = data.result.routes; param.success(data, direction) } else { param.success(data) } }, buildWxRequestConfig(param, options, feature) { var that = this; options.header = { "content-type": "application/json" }; options.method = 'GET'; options.success = function (res) { var data = res.data; if (data.status === 0) { that.handleData(param, data, feature) } else { param.fail(data) } }; options.fail = function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; options.complete = function (res) { var statusCode = +res.statusCode; switch (statusCode) { case ERROR_CONF.WX_ERR_CODE: { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); break } case ERROR_CONF.WX_OK_CODE: { var data = res.data; if (data.status === 0) { param.complete(data) } else { param.complete(that.buildErrorConfig(data.status, data.message)) } break } default: { param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)) } } }; return options }, locationProcess(param, locationsuccess, locationfail, locationcomplete) { var that = this; locationfail = locationfail || function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; locationcomplete = locationcomplete || function (res) { if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) } }; if (!param.location) { that.getWXLocation(locationsuccess, locationfail, locationcomplete) } else if (that.checkLocation(param)) { var location = Utils.getLocationParam(param.location); locationsuccess(location) } } }; class QQMapWX { constructor(options) { if (!options.key) { throw Error('key值不能为空') } this.key = options.key }; search(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, orderby: options.orderby || '_distance', page_size: options.page_size || 10, page_index: options.page_index || 1, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } var distance = options.distance || "1000"; var auto_extend = options.auto_extend || 1; var region = null; var rectangle = null; if (options.region) { region = options.region } if (options.rectangle) { rectangle = options.rectangle } var locationsuccess = function (result) { if (region && !rectangle) { requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else if (rectangle && !region) { requestParam.boundary = "rectangle(" + rectangle + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else { requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SEARCH, data: requestParam }, 'search')) }; Utils.locationProcess(options, locationsuccess) }; getSuggestion(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, region: options.region || '全国', region_fix: options.region_fix || 0, policy: options.policy || 0, page_size: options.page_size || 10, page_index: options.page_index || 1, get_subpois: options.get_subpois || 0, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } if (options.location) { var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) }; Utils.locationProcess(options, locationsuccess) } else { if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) } }; reverseGeocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { coord_type: options.coord_type || 5, get_poi: options.get_poi || 0, output: 'json', key: that.key }; if (options.poi_options) { requestParam.poi_options = options.poi_options } var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'reverseGeocoder')) }; Utils.locationProcess(options, locationsuccess) }; geocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'address')) { return } var requestParam = { address: options.address, output: 'json', key: that.key }; if (options.region) { requestParam.region = options.region } if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'geocoder')) }; getCityList(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_CITY_LIST, data: requestParam }, 'getCityList')) }; getDistrictByCityId(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'id')) { return } var requestParam = { id: options.id || '', output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_AREA_LIST, data: requestParam }, 'getDistrictByCityId')) }; calculateDistance(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { mode: options.mode || 'walking', to: Utils.location2query(options.to), output: 'json', key: that.key }; if (options.from) { options.location = options.from } if (requestParam.mode == 'straight') { var locationsuccess = function (result) { var locationTo = Utils.getEndLocation(requestParam.to); var data = { message: "query ok", result: { elements: [] }, status: 0 }; for (var i = 0; i < locationTo.length; i++) { data.result.elements.push({ distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), duration: 0, from: { lat: result.latitude, lng: result.longitude }, to: { lat: locationTo[i].lat, lng: locationTo[i].lng } }) } var calculateResult = data.result.elements; var distanceResult = []; for (var i = 0; i < calculateResult.length; i++) { distanceResult.push(calculateResult[i].distance) } return options.success(data, { calculateResult: calculateResult, distanceResult: distanceResult }) }; Utils.locationProcess(options, locationsuccess) } else { var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_DISTANCE, data: requestParam }, 'calculateDistance')) }; Utils.locationProcess(options, locationsuccess) } }; direction(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { output: 'json', key: that.key }; if (typeof options.to == 'string') { requestParam.to = options.to } else { requestParam.to = options.to.latitude + ',' + options.to.longitude } var SET_URL_DIRECTION = null; options.mode = options.mode || MODE.driving; SET_URL_DIRECTION = URL_DIRECTION + options.mode; if (options.from) { options.location = options.from } if (options.mode == MODE.driving) { if (options.from_poi) { requestParam.from_poi = options.from_poi } if (options.heading) { requestParam.heading = options.heading } if (options.speed) { requestParam.speed = options.speed } if (options.accuracy) { requestParam.accuracy = options.accuracy } if (options.road_type) { requestParam.road_type = options.road_type } if (options.to_poi) { requestParam.to_poi = options.to_poi } if (options.from_track) { requestParam.from_track = options.from_track } if (options.waypoints) { requestParam.waypoints = options.waypoints } if (options.policy) { requestParam.policy = options.policy } if (options.plate_number) { requestParam.plate_number = options.plate_number } } if (options.mode == MODE.transit) { if (options.departure_time) { requestParam.departure_time = options.departure_time } if (options.policy) { requestParam.policy = options.policy } } var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction', options.mode) } wx.request(Utils.buildWxRequestConfig(options, { url: SET_URL_DIRECTION, data: requestParam }, 'direction')) }; Utils.locationProcess(options, locationsuccess) } }; module.exports = QQMapWX; \ No newline at end of file diff --git a/static/common/icon-dp.png b/static/common/icon-dp.png new file mode 100644 index 0000000..9bbc3e8 --- /dev/null +++ b/static/common/icon-dp.png Binary files differ diff --git a/store/index.js b/store/index.js index 190659b..7406b20 100644 --- a/store/index.js +++ b/store/index.js @@ -28,6 +28,7 @@ 'info': 0, 'flower': 0, 'shopping': 0, + 'follow': 0 }, defaultaddress: {} }, diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index 3d40b8e..90f7b0c 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -82,6 +82,8 @@ }, onLoad() { this.listApi = '/api/collect/list' + this.getList() + this.$http.request('get', '/api/code/value', { params: { type: 'FLOWER_LEVEL' diff --git a/sub_pages/customer/self/follow.vue b/sub_pages/customer/self/follow.vue index 22a77f8..ca6531d 100644 --- a/sub_pages/customer/self/follow.vue +++ b/sub_pages/customer/self/follow.vue @@ -1,29 +1,127 @@ <template> - <view> - - </view> + <view class="follow-page"> + <view class="follow-item m-b-40" v-for="(item,index) of list" :key="index"> + <image class="avatar img100" :src="item.avatar" mode="aspectFill"></image> + <view class="info"> + <view class="name">{{ item.supplierName }}</view> + <view class="time">{{ item.createTime }}</view> + </view> + <view class="m-l-a m-r-0 flex"> + <view class="button button-1" @click="clearFollow(item)">取消关注</view> + <view class="button button-2" @click="toDetail(item)">进店</view> + </view> + </view> + </view> </template> <script> - export default { - data() { - return { - - } - }, - async onPullDownRefresh() { - await this.refreshList() - uni.stopPullDownRefresh() - }, - onLoad(){ - this.listApi = '/api/follow/list' - }, - methods: { - - } - } +export default { + data() { + return {} + }, + async onPullDownRefresh() { + await this.refreshList() + uni.stopPullDownRefresh() + }, + async onShow() { + if (this.sign['follow']) { + await this.$store.dispatch('sign_clear', 'follow'); + this.refreshList() + } + }, + async onLoad() { + await this.$store.dispatch('sign_clear', 'follow'); + this.listApi = '/api/follow/list' + this.getList() + }, + methods: { + toDetail(item) { + uni.navigateTo({ + url: '/sub_pages/customer/shop/shop?id=' + (item.id || '') + }) + }, + clearFollow(item) { + this.$message.showLoading() + // var res; + // if(type){ + // res = await this.$http.request('post',`/api/follow/add`,{ + // data:{ + // supplierId:this.dto.supplierId || this.dto.id + // } + // }) + // }else{ + // res = await this.$http.request('get',`/api/follow/add`,{ + // data:{ + // supplierId:this.dto.supplierId || this.dto.id + // } + // }) + // } + this.$message.hideLoading() + if (code === 0) { + //删除list里的本元素 + for (var i = 0; i < this.list.length; i++) { + if (this.list[i].id === item.id) { + this.list.splice(i, 1) + } + } + } + }, + getList_after() { + // uni. + } + } +} </script> -<style> +<style lang="scss" scoped> +.follow-page { + .follow-item { + .avatar { + width: 114rpx; + height: 114rpx; + border: 2rpx solid #FFFFFF; + border-radius: 50%; + margin-right: 10rpx; + } + .info { + .name { + font-weight: 600; + font-size: 36rpx; + color: #000000; + line-height: 50rpx; + } + + .time { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + } + } + + .button { + padding: 14rpx 36rpx; + text-align: center; + margin-left: 10rpx; + font-weight: 400; + font-size: 24rpx; + line-height: 60rpx; + + } + + .button-1 { + color: #999999; + border-radius: 34rpx; + border: 2rpx solid #999999; + + } + + .button-2 { + border-radius: 34rpx; + border: 2rpx solid #20613D + color: #20613D; + } + } +} </style> diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 5a7cf7a..a8621bc 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -19,36 +19,36 @@ <view class="store-address">云南省-昆明市-官渡区</view> </view> <view class="store-sc m-l-a m-r-0"> - <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.gz"></image> - <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.gz"></image> + <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.gz" @click="updateGz(false)"></image> + <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.gz" @click="updateGz(true)"></image> 关注 </view> </view> - </view> - <view class="tj-info m-t-12"> - <view class="form-item"> - <view class="value">0</view> - <view class="label">发布</view> - </view> - <view class="form-item"> - <view class="value">0</view> - <view class="label">获赞</view> - </view> - <view class="form-item"> - <view class="value">0</view> - <view class="label">粉丝</view> - </view> - <view class="form-item"> - <view class="value">0</view> - <view class="label">关注</view> - </view> + </view> + <view class="tj-info m-t-12"> + <view class="form-item"> + <view class="value">0</view> + <view class="label">发布</view> + </view> + <view class="form-item"> + <view class="value">0</view> + <view class="label">获赞</view> + </view> + <view class="form-item"> + <view class="value">0</view> + <view class="label">粉丝</view> + </view> + <view class="form-item"> + <view class="value">0</view> + <view class="label">关注</view> + </view> </view> <top-tabs :tabs="tabs" :flg="flg" @change="changeTab"> </top-tabs> </view> <view class="brand-info"> - <view v-if="flg=='0'" class="brand-info-0"> + <view v-if="flg==='0'" class="brand-info-0"> <view class="component-filter-container" style="padding-top: 12rpx;"> <view class="flex1"> 排序<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> @@ -110,10 +110,10 @@ </view> - <view v-if="flg=='1'" class="brand-info-1"> + <view v-if="flg==='1'" class="brand-info-1"> <trade :hidefooter="true"></trade> </view> - <view v-if="flg=='3'" class="brand-info-3"> + <view v-if="flg==='2'" class="brand-info-3"> <view class="title"> 基础信息 </view> @@ -149,9 +149,9 @@ { name: '分类' }, - { - name: '评价' - }, + // { + // name: '评价' + // }, { name: '商家' }, @@ -161,6 +161,31 @@ } }, methods: { + //update 关注 + async updateGz(type){ + this.$message.showLoading() + // var res; + // if(type){ + // res = await this.$http.request('post',`/api/follow/add`,{ + // data:{ + // supplierId:this.dto.supplierId || this.dto.id + // } + // }) + // }else{ + // res = await this.$http.request('get',`/api/follow/add`,{ + // data:{ + // supplierId:this.dto.supplierId || this.dto.id + // } + // }) + // } + this.$message.hideLoading() + if(code===0){ + this.dto.gz = !this.dto.gz + await this.$store.dispatch('sign_add', 'follow') + } + + + }, changeTab(flg) { this.flg = flg //如果没有加载数据,需要加载一下 @@ -248,25 +273,25 @@ .brand-top-info { background-image: url('https://hmy-flower.oss-cn-shanghai.aliyuncs.com/37/37dc02b58bd44af79e45031af2bb6c0b%E4%BD%8D%E5%9B%BE@2x.png'); - - .tj-info{ - display: flex; - .form-item{ - flex: 1; - text-align: center; - .label{ - font-weight: 400; - font-size: 32rpx; - color: #FFFFFF; - line-height: 44rpx; - } - .value{ - font-weight: 600; - font-size: 48rpx; - color: #FFFFFF; - line-height: 66rpx; - } - } + + .tj-info{ + display: flex; + .form-item{ + flex: 1; + text-align: center; + .label{ + font-weight: 400; + font-size: 32rpx; + color: #FFFFFF; + line-height: 44rpx; + } + .value{ + font-weight: 600; + font-size: 48rpx; + color: #FFFFFF; + line-height: 66rpx; + } + } } .search-container { display: flex; diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue index 3f9eb68..aee9080 100644 --- a/sub_pages/customer/shopping/confirm.vue +++ b/sub_pages/customer/shopping/confirm.vue @@ -11,6 +11,7 @@ return state.defaultaddress || {} }, }), + }, watch: { // address(nv, ov) { @@ -49,22 +50,76 @@ // private List<FlowerCartListDTO> flowers; // @ApiModelProperty(value = "打包费") // private BigDecimal packing; - //todo 显示打包费等,然后再确认 - // https://lanhuapp.com/web/#/item/project/detailDetach?pid=05830e81-7c59-4655-8253-4deb7c913b51&project_id=05830e81-7c59-4655-8253-4deb7c913b51&image_id=f7cc3e57-5367-4b99-a84e-99c38249aa66&fromEditor=true }, data() { return { - dto: {}, + dto: { + remarks: '', + specialNeeds: '', + transportId: '', + addressId: '', + flowers: [], + }, cacheAddressId: '', transportList: [], - // private Long id; - // @ApiModelProperty(value = "名称") - // private String name; - // @ApiModelProperty(value = "英文名") - // private String enName; - // @ApiModelProperty(value = "运费") - // private BigDecimal fee; + + + } + }, + methods: { + async submitOrder() { + if (!this.dto.transportId) { + this.$message.toast('请选择配送方式') + return + } + if (!this.dto.addressId) { + this.$message.toast('请选择收货地址') + return + } + this.$message.showLoading() + const {code, data} = await this.$http.request('post', '/api/customer/flower/order/confirm', { + data: { + ...this.dto + } + }) + this.$message.hideLoading() + if (code === 0) { + //提交信息 + console.log('pay,', data) + if (data && data['_testOrderId']) { + //回调 + this.$message.showLoading() + const {code, data} = await this.$http.request('get', '/api/customer/flower/order/callback/tmp', { + params: { + id: data['_testOrderId'] + } + }) + this.$message.hideLoading() + } else if (data) { + //微信接口 + let that = this + wx.requestPayment({ + ...data, + async success(res) { + console.log('pay success', res) + this.$message.showToast('支付成功') + //返回上一页 + await this.$store.dispatch('sign_add', 'shopping') + uni.navigateBack() + // uni.navigateTo({ + // url: '/pages/canteen/canteen-success/canteen-success' + // }) + }, + fail(err) { + console.error('pay fail', err) + that.$message.showToast('支付失败') + } + }) + + } + } + } } } @@ -72,17 +127,86 @@ <template> <view class="page-confirm"> - <view> + <view class="p10"> <common-address-select ref="addressselect"></common-address-select> </view> <view> -<!-- todo 查看商品列表,和选择运费 --> + <view class="flower-container"> + <view class="shopping-item m-t-20" v-for="(item,index) of dto.flowers" :key="index"> + <u-divider v-if="index>0"></u-divider> + <view class="sup-title"> + <image class="icon-dp" src="/static/common/icon-dp.png"></image> + {{ item.supplierName || '-' }} + </view> + <view class="item-each flex"> + <image class="img img100 m-r-6" :src="item.url||item.cover"></image> + <view> + <view class="title"><span>{{ item.levelStr || '-' }}</span> {{ item.name || '-' }}</view> + <view class="price"> + {{ item.price || 0 }}*{{ item.num }}扎 + </view> + <view class="desc m-t-12"> + <view class="m-r-15">每扎重量:{{ item.weight || 0 }}</view> + </view> + </view> + </view> + </view> + <view class="price"> + <view class="desc">打包费用:{{ dto.packing || 0 }}}</view> + <view class="m-l-a m-r-0"> + 共{{ dto.flowers.length }}件,小计<span class="t-red">¥{{ dto.totalAmount || 0 }}</span> + </view> + </view> + </view> + <!-- 查看商品列表,和选择运费 --> + <view class="transform-container p10"> + <view class="title flex"> + <view>运输方式:</view> + <!-- <view>约</view>--> + <view class="flex transform-list"> + <view v-for="(transform,index) of transportList" :class="[transform.id===dto.transportId?'cur':'']" + :key="index" class="transform-item" @click="dto.transportId = transform.id"> + <view class="title">{{ transform.name }}</view> + <view class="price">¥{{ transform.fee }}</view> + </view> + </view> + + </view> + <view class="m-t-20" v-if="false"> + <view class="desc-red"> + 10kg以下的零买订单将收取打包费,花店建议购满20kg, 可选冷链物流 + </view> + <view class="desc"> + 预计装1Mini件,运费约18.00元(5公斤内18元,不满5公斤按5公斤计费,每件货不能超过5公斤),第一汤下单预计次日凌晨发货,备货高峰期除外,冷链汽车运输,发货后72小时左右到货,三线城市会推迟6-12小时,顺丰送货到店。 + 优势:价格便宜,顺丰配送 + 弊端:订单必须是5kg以内 + </view> + </view> + </view> + + <view class="form-item p10"> + <view class="label">特殊需求</view> + <view class="m-l-a m-r-0 flex text-right"> + <u-textarea v-model="dto.remarks" placeholder="请输入特殊需求"> + + </u-textarea> + </view> + </view> + <view class="form-item p10"> + <view class="label">留言</view> + <view class="m-l-a m-r-0 flex text-right"> + <u-textarea v-model="dto.remarks" placeholder="填写内容需与卖家协商并确认"> + + </u-textarea> + </view> + </view> + </view> <view class="bottom-price flex"> <view> - 合计:¥ {{ dto.totalAmount||0 }} 元 + 合计:¥ {{ dto.totalAmount || 0 }} 元 </view> - <view class="button-green-1"> + <view class="button-green-1" @click="submitOrder"> 提交订单 </view> </view> @@ -90,7 +214,101 @@ </template> <style scoped lang="scss"> -.page-confirm{ +.page-confirm { + .flower-container { + .shopping-item { + padding: 28rpx 22rpx; + position: relative; + + .sup-title { + border-bottom: 2rpx solid #EEEEEE; + } + + .item-each { + padding-left: 88rpx; + + .img { + width: 124rpx; + height: 124rpx; + } + + .title { + font-weight: 600; + font-size: 28rpx; + + color: #000000; + line-height: 40rpx; + + .level { + color: #20613D; + } + } + + .price { + font-weight: 400; + font-size: 28rpx; + color: #CF0000; + line-height: 40rpx; + } + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + } + + .button-icons { + position: absolute; + } + } + + } + + .transform-container { + .transform-list { + .transform-item { + background: rgba(225, 240, 231, 0.38); + border-radius: 8rpx; + min-height: 112rpx; + border: 2rpx solid rgba(225, 240, 231, 0.38); + padding: 14rpx; + text-align: center; + margin: 0 auto; + max-width: 32%; + + .title { + font-weight: 400; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + } + + .price { + font-weight: 600; + font-size: 32rpx; + color: #20613D; + line-height: 44rpx; + } + } + + .transform-item.cur { + background: #E1F0E7; + border-radius: 8rpx; + border: 2rpx solid #20613D; + } + } + + .transform-list:nth-child(3n+0) { + margin-left: 0 + } + + .transform-list:nth-child(3n+2) { + margin-right: 0; + } + + } .bottom-price { position: fixed; diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index edc0e59..21f5466 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -4,10 +4,10 @@ <view class="category-detail flex"> <view class="flex1 info"> <view class="title flex"> - <view>牛油果泡泡</view> - <view> - <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> - + <view>牛油果泡泡</view> + <view> + <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> + </view> </view> <view class="desc"> @@ -51,7 +51,7 @@ </view> </view> </view> - <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" + <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" @click="toDetail(item)"> <view class="img"> <image class="img img100" @@ -95,21 +95,21 @@ </view> </view> </view> - - - <view class="icon-shop" v-if="list&&list.length>0"> - <!-- 购物图标 --> - <!-- 如果有购买的东西,就要附带数字了 --> - <view v-if="shoptotal>0" class="number"> - {{shoptotal}} - </view> + + + <view class="icon-shop" v-if="list&&list.length>0"> + <!-- 购物图标 --> + <!-- 如果有购买的东西,就要附带数字了 --> + <view v-if="shoptotal>0" class="number"> + {{shoptotal}} + </view> </view> </view> <!-- 判断是否到底了,自动吧 --> - <footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg> - - + <footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg> + + </view> </template> @@ -120,8 +120,8 @@ return { query: { category: '', - }, - shoptotal:0, + }, + shoptotal:0, list:[{},{},{}] } }, @@ -130,7 +130,9 @@ console.log('options', options) this.query.category = options.categoryId || '' this.listApi = '/api/customer/flower/list' - // await this.getList('post') + this.getList() + + // await this.getList('post') // this. }, onReachBottom() { @@ -147,23 +149,23 @@ uni.navigateTo({ url: `/sub_pages/customer/trade/detail?id=${item.id}` }) - }, - mulnum(item) { - if (item.shopnum > 0) { - item.shopnum -= 1 - } - this.shoptotal -= 1 - this.$forceUpdate() - - }, - addnum(item) { - if (item.shopnum) { - item.shopnum += 1 - } else { - item.shopnum = 1 - } - this.shoptotal += 1 - this.$forceUpdate() + }, + mulnum(item) { + if (item.shopnum > 0) { + item.shopnum -= 1 + } + this.shoptotal -= 1 + this.$forceUpdate() + + }, + addnum(item) { + if (item.shopnum) { + item.shopnum += 1 + } else { + item.shopnum = 1 + } + this.shoptotal += 1 + this.$forceUpdate() }, } } @@ -218,7 +220,7 @@ font-weight: 600; font-size: 32rpx; color: #BF0000; - line-height: 44rpx; + line-height: 44rpx; margin-top: 12rpx; } @@ -226,41 +228,41 @@ font-weight: 400; font-size: 24rpx; color: #666666; - line-height: 34rpx; + line-height: 34rpx; margin-top: 12rpx; } } } - - .icon-shop { - position: absolute; - position: fixed; - - background-image: url('../../../static/images/customer/gwc.png'); - width: 140rpx; - height: 140rpx; - // box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.16); - border-radius: 50%; - right: 40rpx; - bottom: 300rpx; - background-size: 100% 100%; - - .number { - width: 30rpx; - height: 30rpx; - background: #F20000; - line-height: 30rpx; - text-align: center; - position: absolute; - right: 14rpx; - top: 14rpx; - color: #FFFFFF; - border-radius: 50%; - font-size: 24rpx; - } - - } - + + .icon-shop { + position: absolute; + position: fixed; + + background-image: url('../../../static/images/customer/gwc.png'); + width: 140rpx; + height: 140rpx; + // box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.16); + border-radius: 50%; + right: 40rpx; + bottom: 300rpx; + background-size: 100% 100%; + + .number { + width: 30rpx; + height: 30rpx; + background: #F20000; + line-height: 30rpx; + text-align: center; + position: absolute; + right: 14rpx; + top: 14rpx; + color: #FFFFFF; + border-radius: 50%; + font-size: 24rpx; + } + + } + } </style> \ No newline at end of file diff --git a/sub_pages/supplier/supplier-info/supplier-info.vue b/sub_pages/supplier/supplier-info/supplier-info.vue index 67e3878..19bb742 100644 --- a/sub_pages/supplier/supplier-info/supplier-info.vue +++ b/sub_pages/supplier/supplier-info/supplier-info.vue @@ -133,7 +133,7 @@ </view> </view> <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx" - v-if="dto.idcardType=='身份证'&&dto.idCards&&dto.idCards.length>0"> + v-if="dto.idcardType==='身份证'&&dto.idCards&&dto.idCards.length>0"> <view class="m-t-12 m-r-10 " v-for="(tBanner,index) of dto.idCards" :key="index"> <image class="banner-img" :src="tBanner.url" @click.stop="previewImg(tBanner.url)"> @@ -151,7 +151,7 @@ </view> </view> <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx" - v-if="dto.idcardType=='营业执照'&&dto.pictures&&dto.pictures.length>0"> + v-if="dto.idcardType==='营业执照'&&dto.pictures&&dto.pictures.length>0"> <view class="m-t-12 m-r-10 " v-for="(tBanner,index) of dto.pictures" :key="index"> <image class="banner-img" :src="tBanner.url" @click.stop="previewImg(tBanner.url)"> -- Gitblit v1.9.3