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>
......
<template>
<view <!-- #ifndef MP-WEIXIN -->
:style="{
transform: `translate(${offsetX}px, ${offsetY}px)`,
MsTransform: `translate(${offsetX}px, ${offsetY}px)`,
MozTransform: `translate(${offsetX}px, ${offsetY}px)`,
WebkitTransform: `translate(${offsetX}px, ${offsetY}px)`,
OTransform: `translate(${offsetX}px, ${offsetY}px)`,
transition: move ? 'none' : 'transform 0.2s ease-in-out',
MsTransition: move ? 'none' : 'transform 0.2s ease-in-out',
MozTransition: move ? 'none' : 'transform 0.2s ease-in-out',
WebkitTransition: move ? 'none' : 'transform 0.2s ease-in-out',
OTransition: move ? 'none' : 'transform 0.2s ease-in-out'
}"
<!-- #endif -->
@click.stop="click"
@touchmove.stop.prevent="touchmove"
@touchstart="touchstart"
@touchend="touchend"
>
<a class="navxfbox25" :href="url" target="_balnk">
<text class="icon iconfont icon-qq icon-qqnavxf"></text>
<view class="texttmavsk">QQ</view>
<view class="texttmavsk">咨询</view>
</a>
<slot>
</slot>
</view>
<view <!-- #ifndef MP-WEIXIN -->
:style="{ transform: `translate(${offsetX}px, ${offsetY}px)`, MsTransform: `translate(${offsetX}px, ${offsetY}px)`, MozTransform: `translate(${offsetX}px, ${offsetY}px)`, WebkitTransform: `translate(${offsetX}px, ${offsetY}px)`, OTransform: `translate(${offsetX}px, ${offsetY}px)`, transition: move ? 'none' : 'transform 0.2s ease-in-out', MsTransition: move ? 'none' : 'transform 0.2s ease-in-out', MozTransition: move ? 'none' : 'transform 0.2s ease-in-out', WebkitTransition: move ? 'none' : 'transform 0.2s ease-in-out', OTransition: move ? 'none' : 'transform 0.2s ease-in-out' }"
<!-- #endif -->
@click.stop="click" @touchmove.stop.prevent="touchmove" @touchstart="touchstart" @touchend="touchend" >
<a class="navxfbox25" :href="url" target="_balnk">
<text class="icon iconfont icon-qq icon-qqnavxf"></text>
<view class="texttmavsk">QQ</view>
<view class="texttmavsk">咨询</view>
</a>
<slot></slot>
</view>
</template>
<script>
export default {
name: 'DragButtonFollow',
props: {
className: {
type: String,
default: ''
},
// #ifdef MP-WEIXIN
style: {
type: String,
default: ''
},
// #endif
drag: {
type: Boolean,
default: true
},
url: {
type: String,
default: ''
},
follow: {
type: String | Boolean,
default: 'all'
},
followNum: {
type: Number,
default: 0
}
},
safeArea: {},
data() {
return {
offsetX: 0,
offsetY: 0,
width: 0,
height: 0,
left: 0,
top: 0,
move: false,
foll: {
}
}
},
mounted() {
const systemInfo = uni.getSystemInfoSync() || {}
this.$options.safeArea = {
left: 0,
top: 0,
right: systemInfo.windowWidth,
bottom: systemInfo.windowHeight
}
const query = this.$parent.createSelectorQuery()
query.select(`.${this.className}`).boundingClientRect(data => {
if (data) {
this.width = data.width
this.height = data.height
this.left = data.left
this.top = data.top
}
}).exec()
if (this.follow) {
const type = this.follow.split(",")
let isLeft, isRight, isTop, isBottom, isAll, num
type.forEach(_ => {
if (_ === 'all') isAll = true
if (_ === 'left') isLeft = true
if (_ === 'right') isRight = true
if (_ === 'top') isTop = true
if (_ === 'bottom') isBottom = true
})
if (isAll) isLeft = isRight = isTop = isBottom = true
num = Math.round(this.width * this.followNum / 100)
this.foll = {
isLeft,
isRight,
isTop,
isBottom,
num
}
}
},
methods: {
click() {
this.$emit('btnClick');
},
touchstart(e) {
if (!this.drag) return
this.move = true
},
touchmove(e) {
if (!this.drag) return
if (!this.move) return
const {
left,
right,
top,
bottom
} = this.$options.safeArea
const dot = e.changedTouches[0]
if (dot.clientX < left + this.width / 2) dot.clientX = left + this.width / 2
if (dot.clientX > right - this.width / 2) dot.clientX = right - this.width / 2
if (dot.clientY < top + this.height / 2) dot.clientY = top + this.height / 2
if (dot.clientY > bottom - this.height / 2) dot.clientY = bottom - this.height / 2
this.offsetX = dot.clientX - this.left - this.width / 2
this.offsetY = dot.clientY - this.top - this.height / 2
// #ifdef MP-WEIXIN
this.$emit("update:style", `
export default {
name: 'DragButtonFollow',
props: {
className: {
type: String,
default: ''
},
// #ifdef MP-WEIXIN
style: {
type: String,
default: ''
},
// #endif
drag: {
type: Boolean,
default: true
},
url: {
type: String,
default: ''
},
follow: {
type: String | Boolean,
default: 'all'
},
followNum: {
type: Number,
default: 0
}
},
safeArea: {},
data() {
return {
offsetX: 0,
offsetY: 0,
width: 0,
height: 0,
left: 0,
top: 0,
move: false,
foll: {}
};
},
mounted() {
const systemInfo = uni.getSystemInfoSync() || {};
this.$options.safeArea = {
left: 0,
top: 0,
right: systemInfo.windowWidth,
bottom: systemInfo.windowHeight
};
const query = this.$parent.createSelectorQuery();
query
.select(`.${this.className}`)
.boundingClientRect(data => {
if (data) {
this.width = data.width;
this.height = data.height;
this.left = data.left;
this.top = data.top;
}
})
.exec();
if (this.follow) {
const type = this.follow.split(',');
let isLeft, isRight, isTop, isBottom, isAll, num;
type.forEach(_ => {
if (_ === 'all') isAll = true;
if (_ === 'left') isLeft = true;
if (_ === 'right') isRight = true;
if (_ === 'top') isTop = true;
if (_ === 'bottom') isBottom = true;
});
if (isAll) isLeft = isRight = isTop = isBottom = true;
num = Math.round((this.width * this.followNum) / 100);
this.foll = {
isLeft,
isRight,
isTop,
isBottom,
num
};
}
},
methods: {
click() {
this.$emit('btnClick');
},
touchstart(e) {
if (!this.drag) return;
this.move = true;
},
touchmove(e) {
if (!this.drag) return;
if (!this.move) return;
const { left, right, top, bottom } = this.$options.safeArea;
const dot = e.changedTouches[0];
if (dot.clientX < left + this.width / 2) dot.clientX = left + this.width / 2;
if (dot.clientX > right - this.width / 2) dot.clientX = right - this.width / 2;
if (dot.clientY < top + this.height / 2) dot.clientY = top + this.height / 2;
if (dot.clientY > bottom - this.height / 2) dot.clientY = bottom - this.height / 2;
this.offsetX = dot.clientX - this.left - this.width / 2;
this.offsetY = dot.clientY - this.top - this.height / 2;
// #ifdef MP-WEIXIN
this.$emit(
'update:style',
`
transform: translate(${this.offsetX}px, ${this.offsetY}px);
WebkitTransform: translate(${this.offsetX}px, ${this.offsetY}px);
transition: ${this.move ? 'none' : 'transform 0.2s ease-in-out'};
WebkitTransition: ${this.move ? 'none' : 'transform 0.2s ease-in-out'};
`)
// #endif
},
touchend(e) {
if (!this.drag) return
this.move = false
if (!this.follow) return
const dot = e.changedTouches[0]
const {
left,
right,
top,
bottom
} = this.$options.safeArea
if (this.foll.isLeft && this.foll.isRight) {
if (dot.clientX <= (left + right) / 2) this.offsetX = this.foll.num - this.left
if (dot.clientX > (left + right) / 2) this.offsetX = right - this.width - this.foll.num - this.left
} else if (this.foll.isLeft) {
this.offsetX = this.foll.num - this.left
} else if (this.foll.isRight) {
this.offsetX = right - this.width - this.foll.num - this.left
}
if (this.foll.isTop && this.foll.isBottom) {
if (dot.clientY <= (top + bottom) / 2) this.offsetY = this.foll.num - this.top
if (dot.clientY > (top + bottom) / 2) this.offsetY = bottom - this.height - this.foll.num - this.top
} else if (this.foll.isTop) {
this.offsetY = this.foll.num - this.top
} else if (this.foll.isBottom) {
this.offsetY = bottom - this.height - this.foll.num - this.top
}
// #ifdef MP-WEIXIN
this.$emit("update:style", `
`
);
// #endif
},
touchend(e) {
if (!this.drag) return;
this.move = false;
if (!this.follow) return;
const dot = e.changedTouches[0];
const { left, right, top, bottom } = this.$options.safeArea;
if (this.foll.isLeft && this.foll.isRight) {
if (dot.clientX <= (left + right) / 2) this.offsetX = this.foll.num - this.left;
if (dot.clientX > (left + right) / 2) this.offsetX = right - this.width - this.foll.num - this.left;
} else if (this.foll.isLeft) {
this.offsetX = this.foll.num - this.left;
} else if (this.foll.isRight) {
this.offsetX = right - this.width - this.foll.num - this.left;
}
if (this.foll.isTop && this.foll.isBottom) {
if (dot.clientY <= (top + bottom) / 2) this.offsetY = this.foll.num - this.top;
if (dot.clientY > (top + bottom) / 2) this.offsetY = bottom - this.height - this.foll.num - this.top;
} else if (this.foll.isTop) {
this.offsetY = this.foll.num - this.top;
} else if (this.foll.isBottom) {
this.offsetY = bottom - this.height - this.foll.num - this.top;
}
// #ifdef MP-WEIXIN
this.$emit(
'update:style',
`
transform: translate(${this.offsetX}px, ${this.offsetY}px);
WebkitTransform: translate(${this.offsetX}px, ${this.offsetY}px);
transition: ${this.move ? 'none' : 'transform 0.2s ease-in-out'};
WebkitTransition: ${this.move ? 'none' : 'transform 0.2s ease-in-out'};
`)
// #endif
},
}
}
`
);
// #endif
}
}
};
</script>
<style scoped>
/* #ifdef MP-WEIXIN */
view {
height: 100%;
width: 100%;
display: inherit;
justify-content: inherit;
align-items: inherit;
}
/* #endif */
.drag-button {
width: 68rpx;
height: 130rpx;
background: #1969F9;
border-radius: 10rpx;
position: fixed;
left: 0px;
top: 50%;
z-index: 777;
}
/* #ifdef MP-WEIXIN */
view {
height: 100%;
width: 100%;
display: inherit;
justify-content: inherit;
align-items: inherit;
}
.navxfbox25 {
width: 68rpx;
height: 130rpx;
text-align: center;
padding-top: 16rpx;
box-sizing: border-box;
display: block;
text-decoration: none;
/* #endif */
.drag-button {
width: 68rpx;
height: 130rpx;
background: #1969f9;
border-radius: 10rpx;
position: fixed;
left: 0px;
top: 50%;
z-index: 777;
}
}
.navxfbox25 {
width: 68rpx;
height: 130rpx;
text-align: center;
padding-top: 16rpx;
box-sizing: border-box;
display: block;
text-decoration: none;
}
.icon-qqnavxf {
font-size: 48rpx;
color: #fff;
}
.icon-qqnavxf {
font-size: 48rpx;
color: #fff;
}
.texttmavsk {
font-size: 20rpx;
color: #fff;
height: 24rpx;
line-height: 24rpx;
}
</style>
\ No newline at end of file
.texttmavsk {
font-size: 20rpx;
color: #fff;
height: 24rpx;
line-height: 24rpx;
}
</style>
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 indexPage">
<drag-button-follow follow="left,right" className="drag-button" class="drag-button" :url="kfurl"></drag-button-follow>
<view class="header " :class="{ fixedtop: scrollTop > 45 }">
<view class="search-topb row bothSide ">
<image src="../../static/logosmall.png"></image>
<navigator class="searchinput row" url="/search">
<text class="icon iconfont icon-search seartext"></text>
<input />
</navigator>
<navigator class="newsbox" url="/user/msg">
<text class="icon iconfont icon-news"></text>
<text class="counts">{{ newscount }}</text>
</navigator>
<view class="cdbox">
<text class="icon iconfont icon-candan"></text>
<text class="sj"></text>
<view class="cdcons">
<a :href="item.url" v-for="(item, index) in pbobj.h5_home_hide_menu" :key="index">{{ item.title }}</a>
</view>
</view>
</view>
<view class="tipsad row avarage">
<view class="taditem" @click="clickbug" v-for="(item, index) in obj.h5_home_concept_text" :key="index">
<text :class="'icon iconfont icon-adindex' + (index + 1)"></text>
<text>{{ item.title }}</text>
</view>
</view>
<view class="bannerbox">
<swiper class="swiper" circular :indicator-dots="autoplay" indicator-color="#fff" :autoplay="autoplay">
<swiper-item v-for="(item, index) in obj.rollbanner" :key="index">
<a :href="item.url"><image :src="item.images"></image></a>
</swiper-item>
</swiper>
</view>
</view>
<view class="ggbox row verCenter">
<text class="icon iconfont icon-tz"></text>
<view class="ggcons">
<view class="ggsec" ref="boxcpr">
<a :href="item.url" class="row" v-for="(item, index) in obj.h5_home_notice" :key="index">
<view class="ggtext row">
<text class="elep titletext">{{ item.title }}</text>
<text>>></text>
</view>
</a>
</view>
</view>
</view>
<view class="szbox row avarage">
<a :href="item.url" v-for="(item, index) in obj.h5_home_function_nav" :key="index">
<image :src="item.images"></image>
<view class="sitips">{{ item.title || '默认文案' }}</view>
</a>
</view>
<view class="brandbox">
<view class="brand-tab row bothSide">
<view :class="{ act: brandact == 1 }" class="tabitem" @click="tabchange(1)">
<text>原厂</text>
<text class="hztext">直供</text>
<view class="hztips">原厂战略合作 官方技术支持</view>
</view>
<view class="tabitem hwxhitem" @click="tabchange(2)">
<text>海外</text>
<text class="hztext">现货</text>
<view class="hztips">海外千万元物料 一站式现货采购</view>
</view>
</view>
<view class="brand-con row bothSide" v-show="brandact == 1">
<a :href="item.url" v-for="(item, index) in obj.h5_home_original_supply" :key="index"><image :src="item.images"></image></a>
</view>
<view class="brand-con row bothSide brand-conxh" v-show="brandact != 1">
<a :href="item.url" v-for="(item, index) in obj.h5_home_oversea_goods" :key="index"><image :src="item.images"></image></a>
</view>
</view>
<view class="goods-box">
<view class="titg">精选物料</view>
<scroll-view class="goods-con" scroll-x="true">
<navigator :url="'/item?goods_id=' + item.goods_id" class="goods-item" v-for="(item, index) in obj.h5_home_choice_goods" :key="index">
<image :src="item.goods_images"></image>
<view class="xhg elep">{{ item.goods_name }}</view>
<view class="ppg elep">
品牌:
<text>{{ item.brand_name }}</text>
</view>
<view class="jgg elep">
价格:
<text>{{ item.price }}</text>
</view>
</navigator>
</scroll-view>
</view>
<view class="fwbox">
<view class="fwinfo">
<view class="tiiw">
<image src="https://img.ichunt.com/images/ichunt/202304/05/57ea7022c4120d275183e00bdf86e97e.png"></image>
猎芯网的服务保障
</view>
<view class="finfocon">每一颗电了物料都将通过猎芯网严格的质量检测,我们将有效把控供应链源头质量,为客户稳定生产保驾护航。成为值得信赖的电子供应链技术与服务提供商。</view>
<view class="rzbox row bothSide">
<view class="rzitem" v-for="(item, index) in obj.h5_home_qualifications" :key="index" v-if="index < 3">
<image :src="item.images"></image>
<text>{{ item.title }}</text>
</view>
</view>
</view>
<view v-for="(item, index) in obj.h5_home_slogan" :key="index">
<view class="videobox">
<view class="tiib">
{{ item.title }}
<image src="https://img.ichunt.com/images/ichunt/202304/05/870dc360521d97062018c93afb40130e.png"></image>
</view>
</view>
<view class="videoval"><video object-fit="fill" :src="item.images"></video></view>
</view>
</view>
<view class="newsbox">
<view class="news-tab row">
<view class="tab-item " @click="newtab(index)" :class="{ act: index == newsindex }" v-for="(item, index) in obj.h5_home_article" :key="index">{{ item.title }}</view>
</view>
<view class="newscons" v-for="(item, index) in obj.h5_home_article" :key="index" v-show="index == newsindex">
<a class="newsconitem row" :href="item1.url" v-for="(item1, index1) in item.article_list" :key="index1">
<view class="row bothSide">
<view class="ncleft">
<view class="titnew elep2">{{ item1.title }}</view>
<view class="tittips elep2">{{ item1.description }}</view>
</view>
<image :src="item1.litpic"></image>
</view>
<view class="newitembottom row bothSide">
<view class="tagbox row">
<view class="tagitem" v-for="(item2, index2) in item1.tag" :key="index2">{{ item2.tag }}</view>
</view>
<view class="newtime">{{ item1.publish_time }}</view>
</view>
</a>
</view>
<view class="newsbot">
<navigator url="/news">
浏览更多资讯
<text class="icon iconfont icon-jt"></text>
</navigator>
</view>
</view>
<view class="pagebot">—— 已经到底了 ——</view>
<view class="page indexPage">
<drag-button-follow follow="left,right" className="drag-button" class="drag-button" :url="kfurl"></drag-button-follow>
<view class="header " :class="{'fixedtop':scrollTop>45}">
<view class="search-topb row bothSide ">
<image src="../../static/logosmall.png"></image>
<navigator class="searchinput row" url="/search">
<text class="icon iconfont icon-search seartext"></text>
<input />
</navigator>
<navigator class="newsbox" url="/user/msg">
<text class="icon iconfont icon-news"></text>
<text class="counts">{{newscount}}</text>
</navigator>
<view class="cdbox">
<text class="icon iconfont icon-candan"></text>
<text class="sj"></text>
<view class="cdcons">
<a :href="item.url" v-for="(item,index) in pbobj.h5_home_hide_menu"
:key="index">{{item.title}}</a>
</view>
</view>
</view>
<view class="tipsad row avarage">
<view class="taditem" @click="clickbug" v-for="(item,index) in obj.h5_home_concept_text" :key="index">
<text :class="'icon iconfont icon-adindex'+(index+1)"></text>
<text>{{item.title}}</text>
</view>
</view>
<view class="bannerbox">
<swiper class="swiper" circular :indicator-dots="autoplay" indicator-color="#fff" :autoplay="autoplay">
<swiper-item v-for="(item, index) in obj.rollbanner" :key="index">
<a :href="item.url">
<image :src="item.images"></image>
</a>
</swiper-item>
</swiper>
</view>
</view>
<view class="ggbox row verCenter">
<text class="icon iconfont icon-tz"></text>
<view class="ggcons">
<view class="ggsec" ref="boxcpr">
<a :href="item.url" class="row" v-for="(item,index) in obj.h5_home_notice" :key="index">
<view class="ggtext row"><text class="elep titletext">{{item.title}}</text> <text>>></text>
</view>
</a>
</view>
</view>
</view>
<view class="szbox row avarage">
<a :href="item.url" v-for="(item,index) in obj.h5_home_function_nav" :key="index">
<image :src="item.images"></image>
<view class="sitips">{{item.title||"默认文案"}}</view>
</a>
</view>
<view class="brandbox">
<view class="brand-tab row bothSide">
<view :class='{"act":brandact==1}' class="tabitem" @click="tabchange(1)">
<text>原厂</text><text class="hztext">直供</text>
<view class="hztips">原厂战略合作 官方技术支持</view>
</view>
<view class="tabitem hwxhitem" @click="tabchange(2)">
<text>海外</text><text class="hztext">现货</text>
<view class="hztips">海外千万元物料 一站式现货采购</view>
</view>
</view>
<view class="brand-con row bothSide" v-show='brandact==1'>
<a :href="item.url" v-for="(item,index) in obj.h5_home_original_supply" :key="index">
<image :src="item.images"></image>
</a>
</view>
<view class="brand-con row bothSide brand-conxh" v-show='brandact!=1'>
<a :href="item.url" v-for="(item,index) in obj.h5_home_oversea_goods" :key="index">
<image :src="item.images"></image>
</a>
</view>
</view>
<view class="goods-box">
<view class="titg">精选物料</view>
<scroll-view class="goods-con" scroll-x="true">
<navigator :url="'/item?goods_id='+item.goods_id" class="goods-item"
v-for="(item,index) in obj.h5_home_choice_goods" :key="index">
<image :src="item.goods_images"></image>
<view class="xhg elep">{{item.goods_name}}</view>
<view class="ppg elep">品牌:<text>{{item.brand_name}}</text></view>
<view class="jgg elep">价格:<text>{{item.price}}</text></view>
</navigator>
</scroll-view>
</view>
<view class="fwbox">
<view class="fwinfo">
<view class="tiiw">
<image src="https://img.ichunt.com/images/ichunt/202304/05/57ea7022c4120d275183e00bdf86e97e.png">
</image>猎芯网的服务保障
</view>
<view class="finfocon">
每一颗电了物料都将通过猎芯网严格的质量检测,我们将有效把控供应链源头质量,为客户稳定生产保驾护航。成为值得信赖的电子供应链技术与服务提供商。
</view>
<view class="rzbox row bothSide">
<view class="rzitem" v-for="(item,index) in obj.h5_home_qualifications" :key="index" v-if="index<3">
<image :src="item.images"></image>
<text>{{item.title}}</text>
</view>
</view>
</view>
<view v-for="(item,index) in obj.h5_home_slogan" :key="index">
<view class="videobox">
<view class="tiib">{{item.title}}
<image
src="https://img.ichunt.com/images/ichunt/202304/05/870dc360521d97062018c93afb40130e.png">
</image>
</view>
</view>
<view class="videoval">
<video object-fit="fill" :src="item.images"></video>
</view>
</view>
</view>
<view class="newsbox">
<view class="news-tab row">
<view class="tab-item " @click="newtab(index)" :class="{act:(index==newsindex)}"
v-for="(item,index) in obj.h5_home_article" :key="index">{{item.title}}</view>
</view>
<view class="newscons" v-for="(item,index) in obj.h5_home_article" :key="index" v-show="index==newsindex">
<a class="newsconitem row" :href="item1.url" v-for="(item1,index1) in item.article_list" :key="index1">
<view class="row bothSide">
<view class="ncleft">
<view class="titnew elep2">{{item1.title}}</view>
<view class="tittips elep2">{{item1.description}}</view>
</view>
<image :src="item1.litpic"></image>
</view>
<view class="newitembottom row bothSide">
<view class="tagbox row">
<view class="tagitem" v-for="(item2,index2) in item1.tag" :key="index2">{{item2.tag}}</view>
</view>
<view class="newtime">{{item1.publish_time}}</view>
</view>
</a>
</view>
<view class="newsbot">
<navigator url="/news">浏览更多资讯<text class="icon iconfont icon-jt"></text></navigator>
</view>
</view>
<view class="pagebot">—— 已经到底了 ——</view>
<bottomNavFixed actval="1" />
</view>
<bottomNavFixed actval="1" />
</view>
</template>
<script>
import {Ichunt_Api,Api_Url} from '@/util/api.js';
import bottomNavFixed from '@/components/bottom_nav.vue';
export default {
data() {
return {
newscount:0,
kfurl:"",
autoplay: true,
scrollTop: 0,
pbobj:{},
obj: {},
brandact: 1,
newsindex: 0,
translateY: 0,
intervalHandler: null
};
},
onShow() {
this.getData();
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
destroyed() {
// 在组件销毁之前,清除 setInterval
clearInterval(this.intervalHandler)
},
methods: {
moveUp() {
const moveDistance=16;
let height_=this.obj.h5_home_notice.length*16;
this.translateY = this.translateY - moveDistance;
if(Math.abs(this.translateY)>=height_){this.translateY=0}
this.$refs.boxcpr.$el.style.transform = `translateY(${this.translateY}px)`
},
newtab(index) {
this.newsindex = index
},
clickbug(e) {
return false
},
tabchange(guid) {
this.brandact = guid;
},
allowChange() {
},
getData() {
this.request(Ichunt_Api + "/api/index/index", 'GET', {}, ).then(res => {
if (res.err_code === 0) {
this.obj = res.data;
clearInterval(this.intervalHandler)
if(this.obj.h5_home_notice.length<=1){
return
}
this.intervalHandler = setInterval(() => {
this.moveUp()
}, 10000)
}
});
this.request(Ichunt_Api + "/api/common/data", 'GET', {}, ).then(res => {
if (res.err_code === 0) {
this.pbobj = res.data;
this.kfurl=this.pbobj.kfqq_xk.data
}
});
this.request(Api_Url + "/msg/allnum", 'POST', {},false,true ).then(res => {
if (res.err_code === 0) {
this.newscount=res.data
}
});
}
},
components: {
bottomNavFixed
import { Ichunt_Api, Api_Url } from '@/util/api.js';
import bottomNavFixed from '@/components/bottom_nav.vue';
export default {
data() {
return {
newscount: 0,
kfurl: '',
autoplay: true,
scrollTop: 0,
pbobj: {},
obj: {},
brandact: 1,
newsindex: 0,
translateY: 0,
intervalHandler: null
};
},
}
};
onShow() {
this.getData();
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
destroyed() {
// 在组件销毁之前,清除 setInterval
clearInterval(this.intervalHandler);
},
methods: {
moveUp() {
const moveDistance = 16;
let height_ = this.obj.h5_home_notice.length * 16;
this.translateY = this.translateY - moveDistance;
if (Math.abs(this.translateY) >= height_) {
this.translateY = 0;
}
this.$refs.boxcpr.$el.style.transform = `translateY(${this.translateY}px)`;
},
newtab(index) {
this.newsindex = index;
},
clickbug(e) {
return false;
},
tabchange(guid) {
this.brandact = guid;
},
allowChange() {},
getData() {
this.request(Ichunt_Api + '/api/index/index', 'GET', {}).then(res => {
if (res.err_code === 0) {
this.obj = res.data;
clearInterval(this.intervalHandler);
if (this.obj.h5_home_notice.length <= 1) {
return;
}
this.intervalHandler = setInterval(() => {
this.moveUp();
}, 10000);
}
});
this.request(Ichunt_Api + '/api/common/data', 'GET', {}).then(res => {
if (res.err_code === 0) {
this.pbobj = res.data;
this.kfurl = this.pbobj.kfqq_xk.data;
}
});
this.request(Api_Url + '/msg/allnum', 'POST', {}, false, true).then(res => {
if (res.err_code === 0) {
this.newscount = res.data;
}
});
}
},
components: {
bottomNavFixed
}
};
</script>
<style scoped lang="scss">
@import '../../assets/css/index/index.scss';
</style>
\ No newline at end of file
@import '../../assets/css/index/index.scss';
</style>
<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) {
......
......@@ -2,72 +2,143 @@
<view class="page-userAddress-add">
<navElement title="新增发票"></navElement>
<view class="tab row avarage verCenter">
<view class="box row rowCenter verCenter" @click="tab(index)" :class="{ curr: index == curr }" :key="index" v-for="(item, index) in text_arr">{{ item }}</view>
<view class="box row rowCenter verCenter" @click="tab(index, 1)" :class="{ curr: index == curr }" :key="index" v-for="(item, index) in text_arr">{{ item }}</view>
</view>
<view class="tip row">
<text class="iconfont icon-ts"></text>
<view class="text column">
<text class="t1">1.自营商品的增值税普通发票,将随货一起快递给您;</text>
<text class="t1">2.默认使用收货地址,您也可以自行修改。</text>
<template v-if="curr == 0">
<text class="t1">1.自营商品的增值税普通发票,将随货一起快递给您;</text>
<text class="t1">2.默认使用收货地址,您也可以自行修改。</text>
</template>
<template v-else-if="curr == 1">
<text class="t1">1、自营商品单笔订单额大于200元,立即申请开票;单笔订单小于200元,统一每月10号开票;</text>
<text class="t1">2、联营商品月消费额最低满1000元,统一开具发票,如未满1000元,则顺延至下月。</text>
</template>
</view>
</view>
<view class="invoice-form">
<view class="label-box"><text class="t1">开票信息</text></view>
<view class="tab-type row bothSide verCenter">
<view class="box curr row rowCenter verCenter">公司</view>
<view class="box row rowCenter verCenter">个人</view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
<!--增值税普通发票-->
<template v-if="curr == 0">
<view class="invoice-form">
<view class="label-box"><text class="t1">开票信息</text></view>
<view class="tab-type row bothSide verCenter">
<view class="box row rowCenter verCenter" @click="tab(index, 2)" :class="{ curr: index == taxIndex }" :key="index" v-for="(item, index) in taxType">{{ item }}</view>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" /></view>
<!-- 公司 -->
<template v-if="taxIndex == 0">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
<view class="input-box" style="margin-bottom: 0;">
<view class="input-label">
<text class="required">*</text>
<text class="tt">税务登记号:</text>
</view>
<view><input type="text" placeholder="请输入税务登记号" class="uni-input" v-model="formParams.tax_no" /></view>
</view>
</template>
<!-- 个人 -->
<template v-else-if="taxIndex == 1">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票人名称:</text>
</view>
<view><input type="text" placeholder="请输入开票人名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
</template>
</view>
<view class="input-box" style="margin-bottom: 0;">
<view class="input-label">
<text class="required">*</text>
<text class="tt">税务登记号:</text>
</template>
<!--增值税专用发票-->
<template v-else-if="curr == 1">
<view class="invoice-form">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">公司注册地址:</text>
</view>
<view><input type="text" placeholder="请输入注册地址" class="uni-input" v-model="formParams.company_address" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">公司电话:</text>
</view>
<view><input type="text" placeholder="请输入电话号码" class="uni-input" v-model="formParams.company_phone" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">纳税人识别号:</text>
</view>
<view><input type="text" placeholder="请输入纳税人识别号" class="uni-input" v-model="formParams.tax_no" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开户银行:</text>
</view>
<view><input type="text" placeholder="请输入开户银行" class="uni-input" v-model="formParams.bank_name" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">银行账号:</text>
</view>
<view><input type="text" placeholder="请输入开户银行账号" class="uni-input" v-model="formParams.bank_account" /></view>
</view>
<view><input type="text" placeholder="请输入税务登记号" class="uni-input" /></view>
</view>
</view>
<view class="setting-default row verCenter bothSide">
</template>
<view class="setting-default row verCenter bothSide" style="margin-bottom: 24rpx;">
<text class="tt">设为默认发票</text>
<view><switch checked style="transform:scale(0.7)" /></view>
<view><switch @change="onSwitchChange" checked style="transform:scale(0.7)" /></view>
</view>
<view class="info-title row bothSide verCenter">
<!-- 收票信息 -->
<view class="info-title row bothSide verCenter" @click="toggle = !toggle" v-if="curr == 0">
<text class="info-title-t1">展开收票信息(非必填)</text>
<text class="iconfont icon-arrtop"></text>
<template v-if="toggle">
<text class="iconfont icon-arrtop"></text>
</template>
<template v-else>
<text class="iconfont icon-arrbot"></text>
</template>
</view>
<view class="form-box">
<view class="form-box" v-if="toggle">
<view class="input-box input row verCenter">
<text class="tt">收货</text>
<input type="text" placeholder="请输入收货人" class="uni-input" />
<text class="tt" :class="{ required: curr == 1 }">收票</text>
<input type="text" placeholder="请输入收票人" class="uni-input" v-model="formParams.consignee" />
</view>
<view class="input-box input row verCenter">
<text class="tt">手机号码</text>
<text class="tt" :class="{ required: curr == 1 }">手机号码</text>
<picker @change="bindPickerChange" :value="index" :range="array" class="intl_code">
<view class="row verCenter bothSide">
<view class="uni-input">{{ array[index] }}</view>
<view class="iconfont icon-arrbot"></view>
</view>
</picker>
<input type="number" placeholder="请输入手机号" class="uni-input" style="margin-left: 24rpx;" />
<input type="number" placeholder="请输入手机号" class="uni-input" style="margin-left: 24rpx;" v-model="formParams.consignee_phone" />
</view>
<view class="input-box input row verCenter">
<text class="tt">所在地区</text>
<picker @change="bindPickerChange" :value="index" :range="array" class="area">
<view class="row verCenter bothSide">
<view class="uni-input">省、市、区</view>
<view class="iconfont icon-arrbot"></view>
</view>
<text class="tt" :class="{ required: curr == 1 }">所在地区</text>
<picker mode="multiSelector" @change="pickerChange" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray" :range-key="'name'">
<view>{{ selectText }}</view>
</picker>
</view>
<view class="input-box textarea row verCenter"><textarea placeholder="请输入详细街道地址"></textarea></view>
<view class="input-box textarea row verCenter"><textarea placeholder="请输入详细街道地址" v-model="formParams.consignee_address"></textarea></view>
</view>
<view class="btn row verCenter">
<view class="btn1 row rowCenter verCenter"><text class="text">保存</text></view>
<view class="btn1 row rowCenter verCenter" @click="invoiceCreate()"><text class="text">保存</text></view>
</view>
</view>
</template>
......@@ -84,22 +155,291 @@ export default {
return {
index: 0,
array: ['0086', '00886', '00853', '00852'],
formParams: {
intl_code: '86'
},
curr: 0,
text_arr: ['增值税普通发票', '增值税专用发票']
text_arr: ['增值税普通发票', '增值税专用发票'],
taxIndex: 0,
taxType: ['公司', '个人'],
toggle: false,
multiArray: [[], [], []], //省市区数据
multiIndex: [0, 0, 0], //选中省市区的索引
selectText: '请选择省市区', //省市区显示文本
formParams: {
inv_type: 4, //发票类型
tax_title: '', //开票公司名称
tax_no: '', //税务登记号
company_address: '', //公司注册地址
company_phone: '', //公司电话
bank_name: '', //开户行
bank_account: '', //开户银行账号
consignee: '', //收票人
consignee_phone: '', //收票手机号
intl_code: '0086',
consignee_province: '', //寄送地址省
consignee_city: '', //寄送地址市
consignee_district: '', //寄送地址区
consignee_address: '', //详细地址
is_default: 1 //设置默认
}
};
},
onLoad() {},
onLoad() {
this.getProvince();
},
methods: {
tab(index) {
this.curr = index;
tab(index, type) {
if (type == 1) {
this.curr = index;
if (this.curr == 0) {
this.formParams.inv_type = 4;
} else if (this.curr == 1) {
this.formParams.inv_type = 3;
this.toggle = true;
}
} else if (type == 2) {
//增值税普通发票公司-个人切换
this.taxIndex = index;
if (this.taxIndex == 0) {
this.formParams.inv_type = 4;
} else if (this.taxIndex == 1) {
this.formParams.inv_type = 2;
}
}
},
/**
* 设置默认监听
* @param {Object} e
*/
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.formParams.intl_code = this.array[e.detail.value];
},
/**
* 新增发票
*/
invoiceCreate() {
if (this.curr == 0) {
if (this.taxIndex == 0) {
//增值税普通发票-公司
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入税务登记号',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
} else if (this.taxIndex == 1) {
//增值税普通发票-个人
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票人名称',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
}
} else {
//增值税专用发票
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.company_address) {
uni.showToast({
title: '请输入注册地址',
icon: 'none'
});
return false;
}
if (!this.formParams.company_phone) {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入纳税人识别号',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_name) {
uni.showToast({
title: '请输入开户银行',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_account) {
uni.showToast({
title: '请输入开户银行账号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee) {
uni.showToast({
title: '请输入收票人',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_province) {
uni.showToast({
title: '请输入省、市、区',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_address) {
uni.showToast({
title: '请输入详细街道地址',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams);
}
this.request(Api_Url + '/invoice/create', 'POST', params, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '新增发票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 省市区联动监听
* @param {Object} e
*/
bindMultiPickerColumnChange(e) {
console.log(e.detail);
if (e.detail.column === 0) {
// 第一列滑动
this.multiIndex[0] = e.detail.value;
this.getCity(this.multiArray[0][e.detail.value].value, true);
// 第一列滑动之后 第二列 和第三列 都变为第一个
this.multiIndex.splice(1, 1, 0);
this.multiIndex.splice(2, 1, 0);
} else if (e.detail.column === 1) {
// 第二列滑动
this.multiIndex[1] = e.detail.value;
this.getDistrict(this.multiArray[1][e.detail.value].value);
// 第二列滑动之后 第三列 变成第一个
this.multiIndex.splice(2, 1, 0);
} else if (e.detail.column === 2) {
// 第三列滑动
this.multiIndex[2] = e.detail.value;
}
this.$forceUpdate();
},
/**
* 省市区选择确定
* @param {Object} e
*/
pickerChange(e) {
this.multiIndex = e.detail.value;
this.formParams.consignee_province = this.multiArray[0][this.multiIndex[0]].value;
this.formParams.consignee_city = this.multiArray[1][this.multiIndex[1]].value;
this.formParams.consignee_district = this.multiArray[2][this.multiIndex[2]].value;
this.selectText = `${this.multiArray[0][this.multiIndex[0]].name + ',' + this.multiArray[1][this.multiIndex[1]].name + ',' + this.multiArray[2][this.multiIndex[2]].name}`;
},
/**
* 获取省数据
*/
getProvince(id = 1) {
console.log('获取省数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[0] = arr;
this.getCity(2, true);
this.$forceUpdate();
}
});
},
/**
* @param {Object} id
* @param {Object} default
*/
getCity(id, defaultParms) {
console.log('获取市数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[1] = arr;
if (defaultParms) {
this.getDistrict(arr[0].value);
}
this.$forceUpdate();
}
});
},
/**
* 获取区数据
* @param {Object} id
*/
getDistrict(id) {
console.log('获取区数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[2] = arr;
this.$forceUpdate();
}
});
}
}
};
......
<template>
<view class="page-userAddress-add">
<navElement title="编辑发票"></navElement>
<navElement title="编辑发票">
<template slot="title-bar">
<view class="delete" @click="deleteInvoice()" style="font-size: 28rpx;color: #1969F9;text-align: right;">删除</view>
</template>
</navElement>
<view class="tab row avarage verCenter">
<view class="box row rowCenter verCenter" @click="tab(index)" :class="{ curr: index == curr }" :key="index" v-for="(item, index) in text_arr">{{ item }}</view>
<view class="box row rowCenter verCenter" @click="tab(index, 1)" :class="{ curr: index == curr }" :key="index" v-for="(item, index) in text_arr">{{ item }}</view>
</view>
<view class="tip row">
<text class="iconfont icon-ts"></text>
<view class="text column">
<text class="t1">1.自营商品的增值税普通发票,将随货一起快递给您;</text>
<text class="t1">2.默认使用收货地址,您也可以自行修改。</text>
<template v-if="curr == 0">
<text class="t1">1.自营商品的增值税普通发票,将随货一起快递给您;</text>
<text class="t1">2.默认使用收货地址,您也可以自行修改。</text>
</template>
<template v-else-if="curr == 1">
<text class="t1">1、自营商品单笔订单额大于200元,立即申请开票;单笔订单小于200元,统一每月10号开票;</text>
<text class="t1">2、联营商品月消费额最低满1000元,统一开具发票,如未满1000元,则顺延至下月。</text>
</template>
</view>
</view>
<view class="invoice-form">
<view class="label-box"><text class="t1">开票信息</text></view>
<view class="tab-type row bothSide verCenter">
<view class="box curr row rowCenter verCenter">公司</view>
<view class="box row rowCenter verCenter">个人</view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
<!--增值税普通发票-->
<template v-if="curr == 0">
<view class="invoice-form">
<view class="label-box"><text class="t1">开票信息</text></view>
<view class="tab-type row bothSide verCenter">
<view class="box row rowCenter verCenter" @click="tab(index, 2)" :class="{ curr: index == taxIndex }" :key="index" v-for="(item, index) in taxType">{{ item }}</view>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" /></view>
<!-- 公司 -->
<template v-if="taxIndex == 0">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
<view class="input-box" style="margin-bottom: 0;">
<view class="input-label">
<text class="required">*</text>
<text class="tt">税务登记号:</text>
</view>
<view><input type="text" placeholder="请输入税务登记号" class="uni-input" v-model="formParams.tax_no" /></view>
</view>
</template>
<!-- 个人 -->
<template v-else-if="taxIndex == 1">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票人名称:</text>
</view>
<view><input type="text" placeholder="请输入开票人名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
</template>
</view>
<view class="input-box" style="margin-bottom: 0;">
<view class="input-label">
<text class="required">*</text>
<text class="tt">税务登记号:</text>
</template>
<!--增值税专用发票-->
<template v-else-if="curr == 1">
<view class="invoice-form">
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开票公司名称:</text>
</view>
<view><input type="text" placeholder="请输入开票公司名称" class="uni-input" v-model="formParams.tax_title" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">公司注册地址:</text>
</view>
<view><input type="text" placeholder="请输入注册地址" class="uni-input" v-model="formParams.company_address" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">公司电话:</text>
</view>
<view><input type="text" placeholder="请输入电话号码" class="uni-input" v-model="formParams.company_phone" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">纳税人识别号:</text>
</view>
<view><input type="text" placeholder="请输入纳税人识别号" class="uni-input" v-model="formParams.tax_no" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">开户银行:</text>
</view>
<view><input type="text" placeholder="请输入开户银行" class="uni-input" v-model="formParams.bank_name" /></view>
</view>
<view class="input-box">
<view class="input-label">
<text class="required">*</text>
<text class="tt">银行账号:</text>
</view>
<view><input type="text" placeholder="请输入开户银行账号" class="uni-input" v-model="formParams.bank_account" /></view>
</view>
<view><input type="text" placeholder="请输入税务登记号" class="uni-input" /></view>
</view>
</view>
<view class="setting-default row verCenter bothSide">
</template>
<view class="setting-default row verCenter bothSide" style="margin-bottom: 24rpx;">
<text class="tt">设为默认发票</text>
<view><switch checked style="transform:scale(0.7)" /></view>
<view><switch @change="onSwitchChange" :checked="is_default" style="transform:scale(0.7)" /></view>
</view>
<view class="info-title row bothSide verCenter">
<!-- 收票信息 -->
<view class="info-title row bothSide verCenter" @click="toggle = !toggle" v-if="curr == 0">
<text class="info-title-t1">展开收票信息(非必填)</text>
<text class="iconfont icon-arrtop"></text>
<template v-if="toggle">
<text class="iconfont icon-arrtop"></text>
</template>
<template v-else>
<text class="iconfont icon-arrbot"></text>
</template>
</view>
<view class="form-box">
<view class="form-box" v-if="toggle">
<view class="input-box input row verCenter">
<text class="tt">收货</text>
<input type="text" placeholder="请输入收货人" class="uni-input" />
<text class="tt" :class="{ required: curr == 1 }">收票</text>
<input type="text" placeholder="请输入收票人" class="uni-input" v-model="formParams.consignee" />
</view>
<view class="input-box input row verCenter">
<text class="tt">手机号码</text>
<text class="tt" :class="{ required: curr == 1 }">手机号码</text>
<picker @change="bindPickerChange" :value="index" :range="array" class="intl_code">
<view class="row verCenter bothSide">
<view class="uni-input">{{ array[index] }}</view>
<view class="iconfont icon-arrbot"></view>
</view>
</picker>
<input type="number" placeholder="请输入手机号" class="uni-input" style="margin-left: 24rpx;" />
<input type="number" placeholder="请输入手机号" class="uni-input" style="margin-left: 24rpx;" v-model="formParams.consignee_phone" />
</view>
<view class="input-box input row verCenter">
<text class="tt">所在地区</text>
<picker @change="bindPickerChange" :value="index" :range="array" class="area">
<view class="row verCenter bothSide">
<view class="uni-input">省、市、区</view>
<view class="iconfont icon-arrbot"></view>
</view>
<text class="tt" :class="{ required: curr == 1 }">所在地区</text>
<picker mode="multiSelector" @change="pickerChange" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray" :range-key="'name'">
<view>{{ selectText }}</view>
</picker>
</view>
<view class="input-box textarea row verCenter"><textarea placeholder="请输入详细街道地址"></textarea></view>
<view class="input-box textarea row verCenter"><textarea placeholder="请输入详细街道地址" v-model="formParams.consignee_address"></textarea></view>
</view>
<view class="btn row verCenter">
<view class="btn1 row rowCenter verCenter"><text class="text">保存</text></view>
<view class="btn1 row rowCenter verCenter" @click="invoiceUpdate()"><text class="text">保存修改</text></view>
</view>
</view>
</template>
......@@ -84,22 +159,412 @@ export default {
return {
index: 0,
array: ['0086', '00886', '00853', '00852'],
formParams: {
intl_code: '86'
},
curr: 0,
text_arr: ['增值税普通发票', '增值税专用发票']
text_arr: ['增值税普通发票', '增值税专用发票'],
taxIndex: 0,
taxType: ['公司', '个人'],
toggle: false,
multiArray: [[], [], []], //省市区数据
multiIndex: [0, 0, 0], //选中省市区的索引
selectText: '请选择省市区', //省市区显示文本
is_default: true,
formParams: {
tax_id: '',
inv_type: 4, //发票类型
tax_title: '', //开票公司名称
tax_no: '', //税务登记号
company_address: '', //公司注册地址
company_phone: '', //公司电话
bank_name: '', //开户行
bank_account: '', //开户银行账号
consignee: '', //收票人
consignee_phone: '', //收票手机号
intl_code: '0086',
consignee_province: '', //寄送地址省
consignee_city: '', //寄送地址市
consignee_district: '', //寄送地址区
consignee_address: '', //详细地址
is_default: 1 //设置默认
}
};
},
onLoad() {},
onLoad(options) {
this.formParams.tax_id = options.tax_id || '';
let inv_type = options.inv_type || '';
if (inv_type == 2) {
this.curr = 0;
this.taxIndex = 1;
} else if (inv_type == 3) {
this.curr = 0;
this.taxIndex = 0;
} else if (inv_type == 4) {
this.curr = 1;
this.taxIndex = 0;
this.toggle = true;
} else {
this.curr = 0;
this.taxIndex = 0;
}
},
onShow() {
this.getData();
},
methods: {
tab(index) {
this.curr = index;
tab(index, type) {
if (type == 1) {
this.curr = index;
if (this.curr == 0) {
this.formParams.inv_type = 4;
} else if (this.curr == 1) {
this.formParams.inv_type = 3;
this.toggle = true;
}
} else if (type == 2) {
//增值税普通发票公司-个人切换
this.taxIndex = index;
if (this.taxIndex == 0) {
this.formParams.inv_type = 4;
} else if (this.taxIndex == 1) {
this.formParams.inv_type = 2;
}
}
},
/**
* @param {Object} arr
* @param {Object} target
* @param {Object} type
*/
findIndex(arr, target, type) {
const result = [];
arr.map((item, index) => {
if (type) {
if (item.value == target) {
result.push(index);
}
} else {
if (item == target) {
result.push(index);
}
}
});
return result;
},
/**
* 设置默认监听
* @param {Object} e
*/
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.formParams.intl_code = this.array[e.detail.value];
},
/**
* 获取信息
*/
getData() {
this.request(Api_Url + '/invoice/info', 'POST', { tax_id: this.formParams.tax_id }, true, true).then(res => {
if (res.err_code === 0) {
this.formParams.inv_type = res.data.inv_type;
this.formParams.tax_title = res.data.tax_title;
this.formParams.tax_no = res.data.tax_no;
this.formParams.company_address = res.data.company_address;
this.formParams.company_phone = res.data.company_phone;
this.formParams.bank_name = res.data.bank_name;
this.formParams.bank_account = res.data.bank_account;
this.formParams.consignee = res.data.consignee;
this.formParams.consignee_phone = res.data.consignee_phone;
this.formParams.intl_code = res.data.intl_code;
this.formParams.consignee_province = res.data.consignee_province;
this.formParams.consignee_city = res.data.consignee_city;
this.formParams.consignee_district = res.data.consignee_district;
this.formParams.consignee_address = res.data.consignee_address;
this.is_default = res.data.is_default == 1 ? true : false;
this.formParams.is_default = res.data.is_default;
this.selectText = `${res.data.consignee_province_val + ',' + res.data.consignee_city_val + ',' + res.data.consignee_district_val}`;
//收票信息
if (this.formParams.consignee && this.formParams.consignee_phone) {
this.toggle = true;
}
//区号
let index = this.findIndex(this.array, res.data.intl_code);
this.index = index;
//初始化省市区
this.getProvince(1, res.data.consignee_province);
}
});
},
/**
* 删除发票
*/
deleteInvoice() {
uni.showModal({
title: '',
content: '您确定删除该发票嘛',
success: res => {
if (res.confirm) {
this.request(Api_Url + '/invoice/delete', 'POST', { tax_id: this.formParams.tax_id }, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
/**
* 更新发票
*/
invoiceUpdate() {
if (this.curr == 0) {
if (this.taxIndex == 0) {
//增值税普通发票-公司
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入税务登记号',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
} else if (this.taxIndex == 1) {
//增值税普通发票-个人
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票人名称',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
}
} else {
//增值税专用发票
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.company_address) {
uni.showToast({
title: '请输入注册地址',
icon: 'none'
});
return false;
}
if (!this.formParams.company_phone) {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入纳税人识别号',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_name) {
uni.showToast({
title: '请输入开户银行',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_account) {
uni.showToast({
title: '请输入开户银行账号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee) {
uni.showToast({
title: '请输入收票人',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_province) {
uni.showToast({
title: '请输入省、市、区',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_address) {
uni.showToast({
title: '请输入详细街道地址',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams);
}
this.request(Api_Url + '/invoice/update', 'POST', params, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '修改发票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 省市区联动监听
* @param {Object} e
*/
bindMultiPickerColumnChange(e) {
console.log(e.detail);
if (e.detail.column === 0) {
// 第一列滑动
this.multiIndex[0] = e.detail.value;
this.getCity(this.multiArray[0][e.detail.value].value, true);
// 第一列滑动之后 第二列 和第三列 都变为第一个
this.multiIndex.splice(1, 1, 0);
this.multiIndex.splice(2, 1, 0);
} else if (e.detail.column === 1) {
// 第二列滑动
this.multiIndex[1] = e.detail.value;
this.getDistrict(this.multiArray[1][e.detail.value].value);
// 第二列滑动之后 第三列 变成第一个
this.multiIndex.splice(2, 1, 0);
} else if (e.detail.column === 2) {
// 第三列滑动
this.multiIndex[2] = e.detail.value;
}
this.$forceUpdate();
},
/**
* 省市区选择确定
* @param {Object} e
*/
pickerChange(e) {
this.multiIndex = e.detail.value;
this.formParams.consignee_province = this.multiArray[0][this.multiIndex[0]].value;
this.formParams.consignee_city = this.multiArray[1][this.multiIndex[1]].value;
this.formParams.consignee_district = this.multiArray[2][this.multiIndex[2]].value;
this.selectText = `${this.multiArray[0][this.multiIndex[0]].name + ',' + this.multiArray[1][this.multiIndex[1]].name + ',' + this.multiArray[2][this.multiIndex[2]].name}`;
},
/**
* 获取省数据
*/
getProvince(id = 1, defaultValue) {
console.log('获取省数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[0] = arr;
if (defaultValue) {
let index = this.findIndex(arr, defaultValue, true);
this.multiIndex.splice(0, 1, index[0]);
}
this.getCity(this.formParams.consignee_province, this.formParams.consignee_city);
this.$forceUpdate();
}
});
},
/**
* 获取市数据
* @param {Object} id
* @param {Object} defaultValue
*/
getCity(id, defaultValue) {
console.log('获取市数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[1] = arr;
if (defaultValue) {
let index = this.findIndex(arr, defaultValue, true);
this.multiIndex.splice(1, 1, index[0]);
this.getDistrict(this.formParams.consignee_city, this.formParams.consignee_district);
}
this.$forceUpdate();
}
});
},
/**
* 获取区数据
* @param {Object} id
*/
getDistrict(id, defaultValue) {
console.log('获取区数据id:' + id);
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) {
arr.push({ name: res.data[key], value: parseInt(key) });
}
this.multiArray[2] = arr;
if (defaultValue) {
let index = this.findIndex(arr, defaultValue, true);
this.multiIndex.splice(2, 1, index[0]);
}
this.$forceUpdate();
}
});
}
}
};
......
<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