Commit 31a21af0 by 肖康

Merge branch 'master' of http://git.ichunt.net/xiaokang/H5_2.0

parents 9b9e739d da2f5d6a
......@@ -19,8 +19,8 @@ export default {
uni-page-head {
display: none;
}
body{
background: #f5f5f5;
body {
background: #f5f5f5;
}
/* #endif */
</style>
......@@ -68,9 +68,9 @@
}
}
.p3 {
height: 66rpx;
font-size: 24rpx;
color: #919399;
margin-bottom: 16rpx;
}
.operate {
.edit {
......@@ -150,7 +150,7 @@
}
.page-userAddress-add {
padding: 180rpx 24rpx 100rpx 24rpx;
padding: 180rpx 24rpx 150rpx 24rpx;
.tip {
margin-top: 16rpx;
margin-bottom: 16rpx;
......@@ -166,13 +166,11 @@
.text {
margin-left: 16rpx;
.t1 {
max-width: 560rpx;
text-align: justify;
font-size: 22rpx;
color: #f98119;
}
.t2 {
font-size: 22rpx;
color: #1969f9;
}
}
}
.tab {
......@@ -223,6 +221,11 @@
width: 155rpx;
font-size: 26rpx;
color: #484b59;
&.required::before {
content: '*';
font-size: 26rpx;
color: #1969f9;
}
}
.intl_code {
.uni-input {
......
......@@ -12,7 +12,7 @@
<text class="icon iconfont icon-car"></text>
<view>
购物车
<text class="counts">{{count}}</text>
<text class="counts">{{ count }}</text>
</view>
</navigator>
<navigator url="/user" class="navitem" :class="{ act: actval == 4 }">
......@@ -23,7 +23,7 @@
</template>
<script>
import {Ichunt_Api,Api_Url} from '@/util/api.js';
import { Ichunt_Api, Api_Url } from '@/util/api.js';
export default {
name: 'bottom_nav',
props: {
......@@ -31,32 +31,30 @@ export default {
type: String,
default: 1
},
carcount: {
type: Number,
default: 0
}
carcount: {
type: Number,
default: 0
}
},
created() {
this.getData();
},
created() {
this.getData();
},
data() {
return {
count:0
};
count: 0
};
},
methods: {
getData() {
this.request(Api_Url + "/cart/count", 'POST', {},false,true ).then(res => {
if (res.err_code === 0) {
this.count=res.data;
console.log(this.carcount)
if(this.carcount){
this.count=this.carcount
}
}
});
}
this.request(Api_Url + '/cart/count', 'POST', {}, false, true).then(res => {
if (res.err_code === 0) {
this.count = res.data;
if (this.carcount) {
this.count = this.carcount;
}
}
});
}
}
};
</script>
......
import App from './App'
import { request} from '@/util/util.js'
import { request } from '@/util/util.js'
import filters from '@/filters'
import router from '@/router/index.js'
import { RouterMount } from 'uni-simple-router'
import directive from '@/directive'
import { Ichunt_Api } from '@/util/api.js';
// #ifndef VUE3
import Vue from 'vue'
......@@ -18,16 +20,33 @@ Object.keys(filters).forEach(key => Vue.filter(key, filters[key]));
//自定义指令
Vue.use(directive);
//定义全局变量
var globalData = {
SEARCH_SUPPLIER_SINGLE: '',
global_contact_us: '',
h5_home_activity_recommend: '',
h5_home_hide_menu: '',
h5_home_hot_search_goods: '',
kfqq_xk: ''
};
//读取全局变量配置
request(Ichunt_Api + '/api/common/data', 'GET', {}, true, true).then(res => {
if (res.err_code === 0) {
globalData.SEARCH_SUPPLIER_SINGLE = res.data.SEARCH_SUPPLIER_SINGLE;
globalData.global_contact_us = res.data.global_contact_us;
globalData.h5_home_activity_recommend = res.data.h5_home_activity_recommend;
globalData.h5_home_hide_menu = res.data.h5_home_hide_menu;
globalData.h5_home_hot_search_goods = res.data.h5_home_hot_search_goods;
globalData.kfqq_xk = res.data.kfqq_xk.data;
Vue.prototype.$globalData = globalData;
}
});
try {
function isPromise(obj) {
return (
!!obj &&
(typeof obj === "object" || typeof obj === "function") &&
typeof obj.then === "function"
);
return (!!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function");
}
// 统一 vue2 API Promise 化返回格式与 vue3 保持一致
......
<template>
<view class="page-userAddress">
<navElement title="发票管理"></navElement>
<template v-if="from">
<navElement title="选择发票"></navElement>
</template>
<template v-else>
<navElement title="发票管理"></navElement>
</template>
<view class="tip row verCenter">
<text class="iconfont icon-ts"></text>
<text class="t1">已创建</text>
......@@ -22,16 +27,32 @@
</view>
<view class="p3">{{ item.consignee_province_val }}{{ item.consignee_city_val }}{{ item.consignee_district_val }}{{ item.consignee_address }}</view>
<view class="operate row bothSide verCenter">
<template v-if="from">
<view class="row verCenter" @click="chooseTax(item.tax_id)">
<view class="default"></view>
<text class="default-text">选择</text>
</view>
</template>
<template v-else>
<template v-if="item.is_default == 1">
<view class="row verCenter default-curr">
<view class="default"></view>
<text class="default-text">默认发票</text>
</view>
</template>
<template v-else>
<view class="row verCenter" @click="setdefault(item.tax_id)">
<view class="default"></view>
<text class="default-text">设为默认</text>
</view>
</template>
</template>
<view class="row verCenter">
<view class="default"></view>
<text class="default-text">设为默认</text>
</view>
<view class="row verCenter">
<navigator class="edit row verCenter" url="/user/invoiceEdit" hover-class="none">
<navigator class="edit row verCenter" :url="'/user/invoiceEdit?tax_id=' + item.tax_id + '&inv_type=' + item.inv_type" hover-class="none">
<text class="iconfont icon-bjt"></text>
<text class="tt">编辑</text>
</navigator>
<view class="delete row verCenter">
<view class="delete row verCenter" @click="deleteInvoice(item.tax_id)">
<text class="iconfont icon-del"></text>
<text class="tt">删除</text>
</view>
......@@ -44,10 +65,18 @@
<text class="tt">暂无发票信息</text>
</view>
<view class="btn row verCenter">
<navigator class="btn1 row rowCenter verCenter" url="/user/invoiceAdd" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">添加新发票</text>
</navigator>
<template v-if="from">
<navigator class="btn1 row rowCenter verCenter" :url="'/user/invoiceAdd?from=' + from" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">添加新发票</text>
</navigator>
</template>
<template v-else>
<navigator class="btn1 row rowCenter verCenter" url="/user/invoiceAdd" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">添加新发票</text>
</navigator>
</template>
</view>
</view>
</template>
......@@ -62,13 +91,75 @@ export default {
},
data() {
return {
from: '',
list: []
};
},
onLoad(options) {
this.from = options.from || '';
},
onShow() {
this.getData();
},
methods: {
/**
* 选择发票
* @param {Object} tax_id
*/
chooseTax(tax_id) {
if (this.from) {
uni.navigateTo({
url: this.from + '?tax_id=' + tax_id
});
}
},
/**
* 删除发票
*/
deleteInvoice(tax_id) {
uni.showModal({
title: '',
content: '您确定删除该发票嘛',
success: res => {
if (res.confirm) {
this.request(Api_Url + '/invoice/delete', 'POST', { tax_id: tax_id }, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
});
setTimeout(() => {
this.getData();
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
/**
* 设置默认地址
* @param {Object} tax_id
*/
setdefault(tax_id) {
this.request(Api_Url + '/invoice/setdefault', 'POST', { tax_id: tax_id }, true, true).then(res => {
if (res.err_code === 0) {
this.getData();
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
getData() {
this.request(Api_Url + '/invoice/lists', 'POST', {}, true, true).then(res => {
if (res.err_code === 0) {
......
<template>
<view class="page-userOrder">
<drag-button-follow follow="left,right" className="drag-button" class="drag-button" :url="kfurl"></drag-button-follow>
<drag-button-follow follow="left,right" className="drag-button" class="drag-button" :url="kfqq_xk"></drag-button-follow>
<view class="top">
<view class="head row bothSide verCenter">
<view class="left row verCenter">
......@@ -153,8 +153,8 @@ export default {
format: true
});
return {
kfqq_xk: '',
time: currentDate,
kfurl: 'https://url.cn/uia2no5Z?_type=wpa&amp;qidian=true',
arr: ['全部', '待付款', '待收货', '已完结订单'],
curr: 0,
list: [],
......@@ -172,6 +172,9 @@ export default {
}
};
},
onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
},
onShow() {
this.getData();
},
......
......@@ -25,7 +25,7 @@
<text class="tt">我的优惠券</text>
<text class="tip"></text>
</navigator>
<a class="box column rowCenter verCenter" :href="userInfo.kefu_url">
<a class="box column rowCenter verCenter" :href="kfqq_xk">
<image src="../../static/qq.png"></image>
<text class="tt">我的客服</text>
</a>
......@@ -120,10 +120,14 @@ export default {
},
data() {
return {
kfqq_xk: '',
userInfo: {},
activity_list: []
};
},
onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
},
onShow() {
this.getData();
},
......@@ -315,6 +319,7 @@ export default {
this.request(Api_Url + '/user/getUserType', 'POST', {}, true, true).then(res => {
if (res.err_code === 0) {
this.userInfo = res.data;
this.$globalData.kefu = res.data.kefu_url;
} else if (res.err_code === 11012) {
uni.navigateTo({
url: '/login'
......
<template>
<view class="page-userAddress">
<navElement title="地址管理"></navElement>
<template v-if="from">
<navElement title="选择收货地址"></navElement>
</template>
<template v-else>
<navElement title="地址管理"></navElement>
</template>
<view class="tip row verCenter" style="margin-bottom: 16rpx;margin-top: 0;">
<text class="iconfont icon-ts"></text>
<text class="t1">已创建</text>
......@@ -17,17 +22,25 @@
</view>
<view class="p2">{{ item.province_val }}{{ item.city_val }}{{ item.district_val }}{{ item.detail_address }}</view>
<view class="operate row bothSide verCenter">
<template v-if="item.is_default == 1">
<view class="row verCenter default-curr">
<template v-if="from">
<view class="row verCenter" @click="chooseAddress(item.address_id)">
<view class="default"></view>
<text class="default-text">默认地址</text>
<text class="default-text">选择</text>
</view>
</template>
<template v-else>
<view class="row verCenter" @click="setdefault(item.address_id)">
<view class="default"></view>
<text class="default-text">设为默认</text>
</view>
<template v-if="item.is_default == 1">
<view class="row verCenter default-curr">
<view class="default"></view>
<text class="default-text">默认地址</text>
</view>
</template>
<template v-else>
<view class="row verCenter" @click="setdefault(item.address_id)">
<view class="default"></view>
<text class="default-text">设为默认</text>
</view>
</template>
</template>
<view class="row verCenter">
<navigator class="edit row verCenter" :url="'/user/userAddressEdit?address_id=' + item.address_id" hover-class="none">
......@@ -47,10 +60,18 @@
<text class="tt">暂无收货地址</text>
</view>
<view class="btn row verCenter">
<navigator class="btn1 row rowCenter verCenter" url="/user/userAddressAdd" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">新增地址</text>
</navigator>
<template v-if="from">
<navigator class="btn1 row rowCenter verCenter" :url="'/user/userAddressAdd?from=' + from" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">新增地址</text>
</navigator>
</template>
<template v-else>
<navigator class="btn1 row rowCenter verCenter" url="/user/userAddressAdd" hover-class="none">
<text class="iconfont icon-tj"></text>
<text class="text">新增地址</text>
</navigator>
</template>
</view>
</view>
</template>
......@@ -65,9 +86,13 @@ export default {
},
data() {
return {
from: '',
list: []
};
},
onLoad(options) {
this.from = options.from || '';
},
onShow() {
this.getData();
},
......@@ -84,6 +109,16 @@ export default {
});
},
/**
* 选择地址
*/
chooseAddress(address_id) {
if (this.from) {
uni.navigateTo({
url: this.from + '?address_id=' + address_id
});
}
},
/**
* 删除地址
* @param {Object} address_id
*/
......
......@@ -49,6 +49,7 @@ export default {
index: 0,
array: ['0086', '00886', '00853', '00852'],
selectText: '请选择省市区',
from: '',
formParams: {
address_type: 0,
consignee: '',
......@@ -62,6 +63,9 @@ export default {
}
};
},
onLoad(options) {
this.from = options.from || '';
},
onShow() {
this.getProvince();
},
......@@ -71,11 +75,15 @@ export default {
this.index = e.detail.value;
this.formParams.intl_code = this.array[e.detail.value];
},
/**
* 设置默认监听
* @param {Object} e
*/
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
/**
* 地址监听
* 省市区联动监听
* @param {Object} e
*/
bindMultiPickerColumnChange(e) {
......@@ -102,7 +110,7 @@ export default {
this.$forceUpdate();
},
/**
* 省市区完成
* 省市区选择确定
* @param {Object} e
*/
pickerChange(e) {
......@@ -118,7 +126,7 @@ export default {
*/
getProvince(id = 1) {
console.log('获取省数据id:' + id);
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, true, true).then(res => {
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, false, true).then(res => {
if (res.err_code === 0) {
var arr = [];
for (var key in res.data) {
......@@ -136,7 +144,7 @@ export default {
*/
getCity(id, defaultParms) {
console.log('获取市数据id:' + id);
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, true, true).then(res => {
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, false, true).then(res => {
if (res.err_code === 0) {
var arr = [];
for (var key in res.data) {
......@@ -156,7 +164,7 @@ export default {
*/
getDistrict(id) {
console.log('获取区数据id:' + id);
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, true, true).then(res => {
this.request(Api_Url + '/address/pcd', 'POST', { id: id }, false, true).then(res => {
if (res.err_code === 0) {
var arr = [];
for (var key in res.data) {
......@@ -171,6 +179,34 @@ export default {
* 保存地址
*/
create() {
if (!this.formParams.consignee) {
uni.showToast({
title: '请输入收货人',
icon: 'none'
});
return false;
}
if (!this.formParams.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!this.formParams.province) {
uni.showToast({
title: '请选择省市区',
icon: 'none'
});
return false;
}
if (!this.formParams.detail_address) {
uni.showToast({
title: '请输入详细街道地址',
icon: 'none'
});
return false;
}
this.request(Api_Url + '/address/create', 'POST', this.formParams, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
......@@ -178,9 +214,15 @@ export default {
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
if (this.from) {
uni.navigateTo({
url: this.from + '?address_id=' + res.data
});
} else {
uni.navigateBack({
delta: 1
});
}
}, 2000);
} else {
uni.showToast({
......
......@@ -111,7 +111,7 @@ export default {
return result;
},
/**
* 地址监听
* 省市区联动监听
* @param {Object} e
*/
bindMultiPickerColumnChange(e) {
......@@ -138,7 +138,7 @@ export default {
this.$forceUpdate();
},
/**
* 省市区完成
* 省市区选择确定
* @param {Object} e
*/
pickerChange(e) {
......@@ -209,6 +209,34 @@ export default {
* 更新
*/
update() {
if (!this.formParams.consignee) {
uni.showToast({
title: '请输入收货人',
icon: 'none'
});
return false;
}
if (!this.formParams.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!this.formParams.province) {
uni.showToast({
title: '请选择省市区',
icon: 'none'
});
return false;
}
if (!this.formParams.detail_address) {
uni.showToast({
title: '请输入详细街道地址',
icon: 'none'
});
return false;
}
this.request(Api_Url + '/address/update', 'POST', this.formParams, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
......@@ -250,6 +278,7 @@ export default {
});
},
/**
* 获取市数据
* @param {Object} id
* @param {Object} defaultValue
*/
......
......@@ -310,7 +310,7 @@ const router = new Router({
//全局路由前置守卫
router.beforeEach((to, from, next) => {
if (to.meta.auth) {
if (to.meta && to.meta.auth) {
if (!getCookie('Yo4teW_uid') || getCookie('Yo4teW_uid') == 0) {
uni.navigateTo({
url: '/login?referer=' + to.aliasPath
......
......@@ -44,6 +44,10 @@ const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
resolve(result);
} else {
reject(response);
uni.showToast({
title: '网络出现问题',
icon: 'error'
});
}
},
fail: (error) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment