Merge branch 'dev-ryan'

# Conflicts:
#	buyer/src/components/header/Header.vue
#	buyer/src/components/invoiceModal/index.vue
#	manager/src/config/index.js
This commit is contained in:
Chopper
2021-06-21 14:26:47 +08:00
150 changed files with 6782 additions and 3034 deletions

View File

@@ -63,17 +63,17 @@ export default {
};
},
methods: {
selectTags (item) {
selectTags (item) { // 选择热门标签
this.searchData = item;
this.search();
},
search () {
search () { // 全平台搜索商品
this.$router.push({
path: '/goodsList',
query: { keyword: this.searchData }
});
},
searchStore () {
searchStore () { // 店铺搜索商品
this.$emit('search', this.searchData)
}
},

View File

@@ -57,7 +57,7 @@ import {
export default {
name: 'addressManage',
props: {
id: {
id: { // 传入的地址id
defalut: '',
type: String
}
@@ -89,7 +89,7 @@ export default {
};
},
methods: {
save () {
save () { // 保存地址
this.$refs.form.validate((valid) => {
if (valid) {
const params = JSON.parse(JSON.stringify(this.formData));
@@ -138,15 +138,15 @@ export default {
this.formData.lat = item.position.lat;
this.formData.lon = item.position.lng;
},
show () {
show () { // 地址模态框显示
this.showAddr = true;
},
hide () {
hide () { // 地址模态框隐藏
this.showAddr = false;
}
},
watch: {
id: {
id: { // 传入的地址id
handler: function (v) {
if (v) {
this.getAddrById(v);

View File

@@ -59,7 +59,6 @@ export default {
isActive: 0 // 已激活tab栏下标
};
},
mounted () {},
methods: {
// 点击右侧的回调
callBack () {

View File

@@ -44,7 +44,7 @@ export default {
};
},
methods: {
getList () {
getList () { // 获取优惠券列表
this.loading = true
memberCouponList(this.params).then(res => {
this.loading = false
@@ -67,18 +67,18 @@ export default {
}
},
changePageNum (val) {
changePageNum (val) { // 分页改变页码
this.params.pageNumber = val;
this.getList()
},
changePageSize (val) {
changePageSize (val) { // 分页改变页数
this.pageNumber = 1;
this.params.pageSize = val;
this.getList()
},
useScope (type, storeName) {
useScope (type, storeName) { // 根据字段返回 优惠券适用范围
let shop = '平台';
let goods = '全部商品'
if (storeName !== 'platform') shop = storeName
@@ -104,7 +104,7 @@ export default {
<style scoped lang="scss">
@import '../../assets/styles/coupon.scss';
.pageration{
text-align: right;
.pageration {
text-align: right;
}
</style>

View File

@@ -151,8 +151,6 @@ export default {
]
};
},
components: {},
mounted () {},
methods: {
getCartList () { // 获取购物车列表
this.loading = true

View File

@@ -44,12 +44,12 @@ export default {
}
},
methods: {
showCartNum (item) {
showCartNum (item) { // 获取购物车数量
if (this.userInfo && item.title === '购物车') {
this.getCartList()
}
},
clickBar (val) {
clickBar (val) { // tabbar点击操作
if (!this.userInfo) {
this.$Modal.confirm({
title: '请登录',
@@ -83,7 +83,7 @@ export default {
}
}
},
openBlank (path) {
openBlank (path) { // 新页面打开地址
let routerUrl = this.$router.resolve({
path: path
})

View File

@@ -13,11 +13,6 @@
<script>
export default {
name: 'Main',
data () {
return {
};
},
props: {
_Title: { // 描述内容
type: null,

View File

@@ -62,7 +62,7 @@ export default {
};
},
methods: {
goArticle () { // 跳转
goArticle () { // 跳转文章页
let routeUrl = this.$router.resolve({
path: '/article'
})

View File

@@ -19,7 +19,7 @@ export default {
time: { // 传入的初始时间
default: 1718977559428
},
type: {
type: { // 区分是在详情还是购物车调用
default: 'goodsDetail', // 设置两个值goodsDetail和cart样式不同
type: String
}
@@ -37,7 +37,7 @@ export default {
this.init()
},
methods: {
countDown (val) {
countDown (val) { // 倒计时方法
function addZero (i) {
return i < 10 ? '0' + i : i + '';
}
@@ -58,8 +58,8 @@ export default {
clearInterval(this.interval)
}
},
init () {
this.interval = setInterval((item) => {
init () { // 初始化
this.interval = setInterval(() => {
this.countDown(this.time);
}, 1000);
}

View File

@@ -20,7 +20,6 @@
<div class="goodsConfig mt_10">
<span @click="collect" ><Icon type="ios-heart" :color="isCollected ? '#ed3f14' : '#666'" />{{isCollected?'已收藏':'收藏'}}</span>
<!-- <span>举报</span> -->
</div>
</div>
<!-- 右侧商品信息活动信息操作展示 -->
@@ -60,7 +59,7 @@
:key="index"
@click="receiveCoupon(item.id)"
>
<span v-if="item.couponType == 'PRICE'">{{ item.consumeThreshold }}{{item.price | unitPrice}}</span>
<span v-if="item.couponType == 'PRICE'">{{ item.consumeThreshold }}{{item.price}}</span>
<span v-if="item.couponType == 'DISCOUNT'">{{ item.consumeThreshold }}{{item.couponDiscount}}</span>
</span>
</p>
@@ -120,38 +119,16 @@
<span class="inventory"> {{skuDetail.weight}}kg</span>
</div>
</div>
<div class="add-buy-car">
<div class="add-buy-car" v-if="$route.query.way === 'POINT'">
<Button type="error" :loading="loading" :disabled="skuDetail.quantity === 0" @click="pointPay">积分购买</Button>
</div>
<div class="add-buy-car" v-else>
<Button type="error" :loading="loading" :disabled="skuDetail.quantity === 0" @click="addShoppingCartBtn">加入购物车</Button>
<Button type="warning" :loading="loading1" :disabled="skuDetail.quantity === 0" @click="buyNow">立即购买</Button>
</div>
</div>
</div>
<!-- <div class="item-detail-see">
<Divider>更多推荐</Divider>
<Row>
<Col :span="24" class="see-Item">
<img class="see-Img" src="https://demo.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489099128797.jpg" alt="" />
<p>
名龙堂i7 6700升7700 GTX1060 6G台式电脑主机DIY游戏组装整机
升6GB独显 送正版WIN10 一年上门
</p>
<p class="global_color">2500.00</p>
</Col>
<Col :span="24" class="see-Item">
<img
class="see-Img"
src="https://demo.dscmall.cn/storage/images/201703/thumb_img/0_thumb_G_1489099128797.jpg"
alt=""
/>
<p>
名龙堂i7 6700升7700 GTX1060 6G台式电脑主机DIY游戏组装整机
升6GB独显 送正版WIN10 一年上门
</p>
<p class="global_color">2500.00</p>
</Col>
</Row>
</div> -->
</div>
</div>
</template>
@@ -247,6 +224,22 @@ export default {
}
});
},
pointPay () { // 积分购买
const params = {
num: this.count,
skuId: this.skuDetail.id,
cartType: 'BUY_NOW'
};
this.loading1 = true;
addCartGoods(params).then(res => {
this.loading1 = false;
if (res.success) {
this.$router.push({path: '/pay', query: {way: 'POINT'}});
} else {
this.$Message.warning(res.message);
}
});
},
async collect () { // 收藏商品
if (this.isCollected) {
let cancel = await cancelCollect('GOODS', this.skuDetail.id)
@@ -338,6 +331,7 @@ export default {
}
},
mounted () {
// 用户登录才会判断是否收藏
if (this.Cookies.getItem('userInfo')) {
isCollection('GOODS', this.skuDetail.id).then(res => {
if (res.success && res.result) {

View File

@@ -38,10 +38,10 @@
</div>
</div>
<div class="remarks-bar">
<span @click="searchByGrade('')" :class="{selectedBar: commentParams.grade === ''}">全部({{commentTypeNum.all}})</span>
<span @click="searchByGrade('GOOD')" :class="{selectedBar: commentParams.grade === 'GOOD'}">好评({{commentTypeNum.good}})</span>
<span @click="searchByGrade('MODERATE')" :class="{selectedBar: commentParams.grade === 'MODERATE'}">中评({{commentTypeNum.moderate}})</span>
<span @click="searchByGrade('WORSE')" :class="{selectedBar: commentParams.grade === 'WORSE'}">差评({{commentTypeNum.worse}})</span>
<span @click="viewByGrade('')" :class="{selectedBar: commentParams.grade === ''}">全部({{commentTypeNum.all}})</span>
<span @click="viewByGrade('GOOD')" :class="{selectedBar: commentParams.grade === 'GOOD'}">好评({{commentTypeNum.good}})</span>
<span @click="viewByGrade('MODERATE')" :class="{selectedBar: commentParams.grade === 'MODERATE'}">中评({{commentTypeNum.moderate}})</span>
<span @click="viewByGrade('WORSE')" :class="{selectedBar: commentParams.grade === 'WORSE'}">差评({{commentTypeNum.worse}})</span>
</div>
<div style="text-align: center;margin-top: 20px;" v-if="commentList.length === 0">
暂无评价数据
@@ -86,9 +86,6 @@
</div>
</div>
</TabPane>
<!-- <TabPane label="商品问答">
<ShowGoodsQuestion/>
</TabPane> -->
</Tabs>
</div>
</div>
@@ -97,7 +94,6 @@
</template>
<script>
import ShowGoodsQuestion from '@/components/goodsDetail/ShowGoodsQuestion';
import { goodsComment, goodsCommentNum } from '@/api/member.js';
export default {
name: 'ShowGoodsDetail',
@@ -122,21 +118,21 @@ export default {
};
},
computed: {
skuDetail () {
skuDetail () { // skuId
return this.detail.data;
}
},
methods: {
changeHeight (name) {
changeHeight (name) { // 设置商品详情高度
let heightCss = window.getComputedStyle(this.$refs[name]).height;
heightCss = parseInt(heightCss.substr(0, heightCss.length - 2)) + 89;
this.$refs.itemIntroDetail.style.height = heightCss + 'px';
},
changePageNum (val) {
changePageNum (val) { // 修改评论页码
this.commentParams.pageNumber = val;
this.getList();
},
changePageSize (val) {
changePageSize (val) { // 修改评论页数
this.commentParams.pageNumber = 1;
this.commentParams.pageSize = val;
this.getList();
@@ -155,12 +151,12 @@ export default {
}
});
},
searchByGrade (grade) {
viewByGrade (grade) { // 好中差评切换
this.$set(this.commentParams, 'grade', grade);
this.commentParams.pageNumber = 1;
this.getList();
},
tabClick (name) {
tabClick (name) { // 商品详情和评价之间的tab切换
if (name === 0) {
this.$nextTick(() => {
this.changeHeight('itemIntroGoods')
@@ -198,7 +194,7 @@ export default {
}
}
},
handleScroll () {
handleScroll () { // 监听页面滚动
if (this.onceFlag) {
this.$nextTick(() => {
this.changeHeight('itemIntroGoods')
@@ -208,15 +204,12 @@ export default {
}
},
mounted () {
this.$nextTick(() => {
this.$nextTick(() => { // 手动设置详情高度,解决无法撑开问题
setTimeout(this.changeHeight('itemIntroGoods'), 2000);
});
window.addEventListener('scroll', this.handleScroll)
this.getList();
},
components: {
ShowGoodsQuestion
}
};
</script>
@@ -283,14 +276,12 @@ export default {
}
.item-intro-detail{
margin: 0 30px;
// min-height: 1500px;
width: 100%;
}
.item-intro-nav{
width: 100%;
height: 38px;
background-color: #F7F7F7;
// border-bottom: 1px solid $theme_color;
}
.item-intro-nav ul{
margin: 0px;
@@ -329,8 +320,6 @@ export default {
width: 240px;
height: 36px;
font-size: 14px;
/* text-align: center; */
/* background-color: #ccc; */
}
.item-param-title {
color: #232323;

View File

@@ -1,53 +0,0 @@
<template>
<div class="wrapper">
<div v-if="true" class="question-list">
<div class="-item" v-for="index in 6" :key="index">
<!-- 提问 -->
<div class="-item-put -item-div">
<div class="-item-div-l blod">
<Tag color="warning"></Tag>
有屏幕调节亮度吗
</div>
<div class="-item-div-r">2020年10月21日17:03:35</div>
</div>
<!-- 解答 -->
<div class="-item-reply -item-div">
<div class="-item-div-l">
<Tag color="success"></Tag>
能调节点屏幕上方有一条调整带可正负2调整
</div>
<div class="-item-div-r">2020年10月21日17:03:35</div>
</div>
</div>
</div>
<div v-else class="question-empty">
<empty></empty>
</div>
</div>
</template>
<script>
export default {};
</script>
<style scoped lang="scss">
.-item-div {
padding: 10px 0;
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px 0;
}
.-item-div-l {
display: flex;
@include content_color($light_content_color);
}
.-item-div-r {
@include sub_color($light_content_color);
}
.blod {
font-weight: bold;
}
.-item {
margin: 10px 0;
border-bottom: 1px solid $border_color;
}
</style>

View File

@@ -1,85 +0,0 @@
<template>
<div>
<div class="remarks-title">
<span>售后保障</span>
</div>
<div class="item-protect-container">
<div class="item-protect-box">
<p class="item-protect-title-box">
<Avatar style="background-color: #e4393c" icon="ribbon-a" />
<span class="item-protect-title">卖家服务</span>
</p>
<p class="item-protect-detail">
高品质敢承诺7天无理由退货30天免费换新质量问题商家承担来回运费换新如需发票请在确认收货无误后联系商家开出*发票不随货品一同发出
</p>
</div>
<div class="item-protect-box">
<p class="item-protect-title-box">
<Avatar style="background-color: #e4393c" icon="cash" />
<span class="item-protect-title">平台承诺</span>
</p>
<p class="item-protect-detail">
平台卖家销售并发货的商品由平台卖家提供发票和相应的售后服务请您放心购买<br> 因厂家会在没有任何提前通知的情况下更改产品包装产地或者一些附件本司不能确保客户收到的货物与商城图片产地附件说明完全一致只能确保为原厂正货并且保证与当时市场上同样主流新品一致若本商城没有及时更新请大家谅解
</p>
</div>
<div class="item-protect-box">
<p class="item-protect-title-box">
<Avatar style="background-color: #e4393c" icon="locked" />
<span class="item-protect-title">正品行货</span>
</p>
<p class="item-protect-detail">
BIT商城向您保证所售商品均为正品行货BIT自营商品开具机打发票或电子发票
</p>
</div>
<div class="item-protect-box">
<p class="item-protect-title-box">
<Avatar style="background-color: #e4393c" icon="settings" />
<span class="item-protect-title">全国联保</span>
</p>
<p class="item-protect-detail">
凭质保证书及BIT商城发票可享受全国联保服务奢侈品钟表除外奢侈品钟表由BIT联系保修享受法定三包售后服务与您亲临商场选购的商品享受相同的质量保证BIT商城还为您提供具有竞争力的商品价格和运费政策请您放心购买<br><br> 因厂家会在没有任何提前通知的情况下更改产品包装产地或者一些附件本司不能确保客户收到的货物与商城图片产地附件说明完全一致只能确保为原厂正货并且保证与当时市场上同样主流新品一致若本商城没有及时更新请大家谅解
</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'ShowProductWarranty'
};
</script>
<style scoped lang="scss">
.remarks-title {
padding-left: 15px;
height: 36px;
font-size: 16px;
font-weight: bolder;
line-height: 36px;
color: #666666;
background-color: #F7F7F7;
}
.item-protect-container {
padding: 15px;
}
.item-protect-box {
margin-bottom: 30px;
}
.item-protect-title-box {
display: flex;
align-items: center;
}
.item-protect-title {
padding-left: 15px;
font-size: 20px;
font-weight: bolder;
color: $theme_color;
}
.item-protect-detail {
padding-top: 5px;
padding-left: 46px;
font-size: 14px;
color: #999;
}
</style>

View File

@@ -9,7 +9,6 @@
</li>
</ul>
<ul class="detail">
<!-- <li class="first hover-pointer" @click="handleClickTheme()">切换主题</li> -->
<li class="first" v-show="!userInfo.username">
<router-link :to="`/login?rePath=${$route.path}&query=${JSON.stringify($route.query)}`">
<span style="border:none" class="tipsLogin">请登录</span>
@@ -35,14 +34,18 @@
</DropdownMenu>
</Dropdown>
</li>
<li class="hover-color" @click="goUserCenter('/home/MyOrder')"><span class="nav-item">我的订单</span></li>
<li class="hover-color" @click="goUserCenter('/home/MyTracks')"><span class="nav-item">我的足迹</span></li>
<li @click="goUserCenter('/home/MyOrder')"><span class="nav-item hover-color">我的订单</span></li>
<li @click="goUserCenter('/home/MyTracks')"><span class="nav-item hover-color">我的足迹</span></li>
<li @click="goUserCenter('/home/MsgList')"><span class="nav-item hover-color">我的消息</span></li>
<li v-if="$route.name !== 'Cart'" style="position:relative;">
<i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i>
<Dropdown placement="bottom-start">
<router-link to="/cart" target="_blank">
<span @mouseenter="getCartList">
<Icon size="18" class="cart-icon" type="ios-cart-outline"></Icon>
<Icon
size="18"
type="ios-cart-outline"
></Icon>
购物车
</span>
@@ -116,37 +119,28 @@ export default {
},
},
methods: {
handleClickTheme() {
this.themeType === "light"
? (this.themeType = "dark")
: (this.themeType = "light");
window.document.documentElement.setAttribute(
"data-theme",
this.themeType
);
},
changeCity(city) {
changeCity (city) { // 选择所在城市
this.city = city;
},
goToPay() {
goToPay () { // 跳转购物车
let url = this.$router.resolve({
path: "/cart",
});
window.open(url.href, "_blank");
},
myInfo() {
myInfo () { // 跳转会员中心
let url = this.$router.resolve({
path: "/home",
});
window.open(url.href, "_blank");
},
signOutFun() {
storage.removeItem("accessToken");
storage.removeItem("refreshToken");
storage.removeItem("userInfo");
storage.removeItem("cartNum");
this.$store.commit("SET_CARTNUM", 0);
this.$router.push("/login");
signOutFun () { // 退出登录
storage.removeItem('accessToken');
storage.removeItem('refreshToken');
storage.removeItem('userInfo');
storage.removeItem('cartNum');
this.$store.commit('SET_CARTNUM', 0)
this.$router.push('/login');
},
goUserCenter(path) {
// 跳转我的订单,我的足迹
@@ -230,13 +224,13 @@ export default {
float: left;
font-size: 14px;
line-height: 35px;
margin-right: 15px;
margin-right: 10px;
font-weight: bold;
}
.nav a,
.nav-item {
text-decoration: none;
padding-left: 15px;
padding-left: 10px;
border-left: 1px solid #ccc;
color: #999;
cursor: pointer;
@@ -377,9 +371,6 @@ export default {
.sign-out p {
font-size: 12px;
}
.cart-icon {
padding: 0 6px;
}
.goods-title:hover {
color: $theme_color;
}

View File

@@ -1,10 +1,10 @@
<template>
<div class="shop-box">
<div class="shop-container">
<div class="shop-title">
<div class="shop-title-content">
<p><router-link :to="`/merchant?id=${skuDetail.storeId}`">{{ skuDetail.storeName }}</router-link></p>
</div>
<div class="shop-title-content">
<img class="hover-pointer" @click="linkTo(`/merchant?id=${storeDetail.storeId}`)" :src="storeDetail.storeLogo" height="40" alt="">
<p><router-link :to="`/merchant?id=${storeDetail.storeId}`">{{ storeDetail.storeName }}</router-link></p>
<div class="ml_20" v-html="storeDetail.storeDesc"></div>
</div>
</div>
</div>
@@ -20,7 +20,7 @@ export default {
}
},
computed: {
skuDetail () {
storeDetail () { // 店铺详情
return this.detail;
}
}
@@ -46,57 +46,17 @@ export default {
color: #fff;
}
.shop-title {
display: flex;
flex-direction: row;
}
.shop-title-icon {
font-size: 46px;
}
.shop-title-content {
padding-top: 8px;
margin-left: 15px;
display: flex;
align-items: center;
}
.shop-title-content p {
line-height: 26px;
font-size: 20px;
}
.shop-title-content p:nth-child(2) {
font-size: 16px;
margin-left: 20px;
}
.shop-title-content a {
color: #fff;
}
.shop-another-item {
display: flex;
flex-direction: row;
}
.shop-another-item-detail {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 15px;
}
.shop-another-item-img {
height: 80px;
border-radius: 40px;
overflow: hidden;
}
.shop-another-item-img img {
width: 80px;
}
.shop-anoter-item-intro {
margin-left: 15px;
}
</style>

View File

@@ -23,7 +23,7 @@ export default {
}
},
methods: {
goCartList () {
goCartList () { // 跳转购物车页面
let routerUrl = this.$router.resolve({
path: '/cart'
})

View File

@@ -67,14 +67,14 @@ export default {
};
},
methods: {
getArticleList () {
getArticleList () { // 获取常见问题列表
articleList(this.params).then(res => {
if (res.success) {
this.articleList = res.result.records
}
})
},
goArticle (id) {
goArticle (id) { // 跳转文章详情
let routeUrl = this.$router.resolve({
path: '/article',
query: {id}

View File

@@ -32,7 +32,6 @@ export default {
options: this.data.options // 装修数据
};
},
methods: {}
};
</script>
<style lang="scss" scoped>

View File

@@ -50,9 +50,8 @@ export default {
this.$emit('content', val);
}
},
mounted () {},
methods: {
changeCurr (index) {
changeCurr (index) { // 选择分类
this.currentIndex = index;
}
}

View File

@@ -71,7 +71,7 @@ export default {
};
},
watch: {
diffSeconds (val) {
diffSeconds (val) { // 秒杀倒计时
const hours = Math.floor(val / 3600);
// 当前秒数 / 60向下取整
// 获取到所有分钟数 3600 / 60 = 60分钟
@@ -139,7 +139,7 @@ export default {
}, 1000);
}
},
goPromotion () {
goPromotion () { // 跳转秒杀页面
let routeUrl = this.$router.resolve({
path: '/seckill'
});

View File

@@ -1,3 +1 @@
## 此组件为结算页面修改发票信息使用 后续可以复用到个人信息添加发票页面
### 目前没有参数,之后会设置一个参数接收历史的单位发票数据

View File

@@ -11,37 +11,42 @@
</div> -->
<!-- 普通发票 -->
<div class="nav-content">
<Form :model="invoiceForm" ref="form" label-position="left" :rules="ruleInline" :label-width="110">
<Form
:model="invoiceForm"
ref="form"
label-position="left"
:rules="ruleInline"
:label-width="110"
>
<FormItem label="发票类型">
<RadioGroup v-model="invoice" type="button" button-style="solid">
<Radio @on-change="changeInvoice" :label="1">电子普通发票</Radio>
<Radio :label="2" :disabled="true">增值税专用发票</Radio>
</RadioGroup>
</FormItem>
<FormItem label="发票抬头">
<RadioGroup v-model="type" @on-change="changeInvoice" type="button" button-style="solid">
<RadioGroup v-model="invoiceForm.type" type="button" button-style="solid">
<Radio :label="1">个人</Radio>
<Radio :label="2">单位</Radio>
</RadioGroup>
</FormItem>
<FormItem label="个人名称" v-if="type === 1" prop="receiptTitle">
<FormItem
label="发票抬头"
v-if="invoiceForm.type == 2"
prop="receiptTitle"
>
<i-input v-model="invoiceForm.receiptTitle"></i-input>
</FormItem>
<FormItem label="单位名称" v-if="type === 2" prop="receiptTitle">
<i-input v-model="invoiceForm.receiptTitle"></i-input>
</FormItem>
<FormItem label="纳税人识别号" v-if="type === 2" prop="taxpayerId">
<FormItem
label="纳税人识别号"
v-if="invoiceForm.type == 2"
prop="taxpayerId"
>
<i-input v-model="invoiceForm.taxpayerId"></i-input>
</FormItem>
<FormItem label="发票内容">
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
<Radio label="不开发票">不开发票</Radio>
<Radio label="商品明细">商品明细</Radio>
<Radio label="商品类别">商品类别</Radio>
</RadioGroup>
</FormItem>
</Form>
<div style="text-align: center">
<Button type="primary" :loading="loading" @click="submit">保存发票信息</Button>
<Button type="primary" :loading="loading" @click="save">保存发票信息</Button>
<Button type="default" @click="invoiceAvailable = false">取消</Button>
</div>
</div>
@@ -49,104 +54,100 @@
</div>
</template>
<script>
import { receiptSelect } from "@/api/cart.js";
import { TINumber } from "@/plugins/RegExp.js";
import { saveReceipt } from '@/api/member.js';
import { TINumber } from '@/plugins/RegExp.js';
export default {
name: "invoiceModal",
data() {
name: 'invoiceModal',
data () {
return {
invoice: 1,
invoiceAvailable: false, // 模态框显隐
loading: false, // 提交状态
invoiceForm: {
// 发票表单
invoiceForm: { // 发票表单
// 普票表单
receiptTitle: "", // 发票抬头
taxpayerId: "", // 纳税人识别号
receiptContent: "商品明细", // 发票内容
receiptTitle: '', // 发票抬头
taxpayerId: '', // 纳税人识别号
receiptContent: '不开发票', // 发票内容
type: 1 // 1 个人 2 单位
},
type: 1, // 1 个人 2 单位
ruleInline: {
ruleInline: { // 验证规则
receiptTitle: [{ required: true, message: '请填写公司名称' }],
taxpayerId: [
{ required: true, message: "请填写纳税人识别号" },
{ pattern: TINumber, message: "请填写正确的纳税人识别号" },
],
},
{ required: true, message: '请填写纳税人识别号' },
{ pattern: TINumber, message: '请填写正确的纳税人识别号' }
]
}
};
},
props: ["invoiceData"],
watch: {
invoiceData: {
handler(val) {
this.invoiceForm = { ...val };
if (val.taxpayerId) {
this.type = 2;
} else {
this.type = 1;
}
},
deep: true,
immeadite: true,
},
},
methods: {
/**
* 选择发票抬头
*/
changeInvoice(val) {
this.$nextTick(() => {
this.type = val;
});
},
/**
* 保存判断
*/
save() {
let flage = true;
// 保存分为两种类型,个人以及企业
const { type, receiptTitle, receiptContent } = JSON.parse(
JSON.stringify(this.invoiceForm)
);
// 判断是否填写发票抬头
if (!receiptTitle) {
this.$Message.error("请填写发票抬头!");
flage = false;
return false;
}
if (type == 2) {
this.$refs.form.validate((valid) => {
if (!valid) {
flage = false;
save () { // 保存发票
if (this.invoiceForm.type === 1) {
// 个人
let flag = true;
this.receiptItems.forEach((e) => {
if (
e.receiptTitle === '个人' &&
e.receiptContent === this.invoiceForm.receiptContent
) {
this.$emit('change', e);
flag = false;
this.invoiceAvailable = false;
}
});
} else {
delete this.invoiceForm.taxpayerId;
}
return flage;
},
async submit() {
if (this.save()) {
this.loading = true;
let submit = {
way: this.$route.query.way,
...this.invoiceForm,
};
let receipt = await receiptSelect(submit);
if (receipt.success) {
this.$emit("change", true);
if (flag) {
let params = {
receiptTitle: '个人',
receiptContent: this.invoiceForm.receiptContent
};
this.loading = true;
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
this.loading = false;
} else {
// 单位
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
let params = {
receiptTitle: this.invoiceForm.receiptTitle,
taxpayerId: this.invoiceForm.taxpayerId,
receiptContent: this.invoiceForm.receiptContent
};
let flag = true;
this.receiptItems.forEach((e) => {
if (e.taxpayerId === params.taxpayerId) {
flag = false;
}
});
if (!flag) {
this.$Message.error('已有当前税号的发票信息,请直接选择已有发票');
} else {
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
}
});
}
},
},
}
}
};
</script>
<style lang="scss" scoped>

View File

@@ -85,7 +85,7 @@ export default {
this.$emit('getAddress', this.addrContent);
}
},
init () {
init () { // 初始化地图
AMapLoader.load({
key: 'b440952723253aa9fe483e698057bf7d', // 申请好的Web端开发者Key首次调用 load 时必填
version: '', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15

View File

@@ -21,7 +21,7 @@ export default {
props: ['addressId'],
mounted () {},
methods: {
change (val, selectedData) {
change (val, selectedData) { // 选择地区
/**
* @returns [regionId,region]
*/
@@ -30,7 +30,7 @@ export default {
selectedData[selectedData.length - 1].__label.split('/')
]);
},
loadData (item, callback) {
loadData (item, callback) { // 加载数据
item.loading = true;
getRegion(item.value).then((res) => {
if (res.result.length <= 0) {
@@ -59,7 +59,7 @@ export default {
}
});
},
async init () {
async init () { // 初始化地图数据
let data = await getRegion(0);
let arr = [];
data.result.forEach((item) => {

View File

@@ -209,7 +209,7 @@ export default {
},
deep: true
},
'$route': {
'$route': { // 监听路由
handler (val, oVal) {
if (this.$route.query.categoryId) {
let cateId = this.$route.query.categoryId.split(',')
@@ -373,6 +373,7 @@ export default {
}
},
mounted () {
// 有分类id就根据id搜索
if (this.$route.query.categoryId) {
let cateId = this.$route.query.categoryId.split(',')
Object.assign(this.params, this.$route.query)

View File

@@ -93,6 +93,11 @@ export default {
getCategory(0).then(res => {
if (res.success) {
this.cateList = res.result;
// 过期时间
var expirationTime = new Date().setHours(new Date().getHours() + 1);
// 存放过期时间
localStorage.setItem('category_expiration_time', expirationTime);
// 存放分类信息
localStorage.setItem('category', JSON.stringify(res.result))
}
});
@@ -117,7 +122,12 @@ export default {
}
},
mounted () {
if (localStorage.getItem('category')) {
if (localStorage.getItem('category') && localStorage.getItem('category_expiration_time')) {
// 如果缓存过期,则获取最新的信息
if (new Date() > localStorage.getItem('category_expiration_time')) {
this.getCate();
return;
}
this.cateList = JSON.parse(localStorage.getItem('category'))
} else {
this.getCate()

View File

@@ -6,7 +6,7 @@
#### 在组件上添加v-if来判断组件显隐
#### verifyType 验证格式[ 'LOGIN' ,'REGISTER' ]等,详情看接口文档
#### verifyType 验证格式[ 'LOGIN' ,'REGISTER' ]
#### @change方法 获取回调,参数为对象 {status:false,distance:100} status 为回调状态distance为移动距离

View File

@@ -43,11 +43,11 @@ export default {
};
},
methods: {
mouseDown (e) {
mouseDown (e) { // 鼠标按下操作,
this.downX = e.clientX;
this.flag = true;
},
mouseMove (e) {
mouseMove (e) { // 鼠标移动
if (this.flag) {
let offset = e.clientX - this.downX;
@@ -60,7 +60,7 @@ export default {
}
}
},
mouseUp () {
mouseUp () { // 鼠标抬起
if (!this.flag) return false;
this.flag = false;
let params = {
@@ -83,7 +83,7 @@ export default {
}
});
},
refresh () {
refresh () { // 刷新验证图片
this.flag = false;
this.downX = 0;
this.distance = 0;
@@ -91,7 +91,7 @@ export default {
this.verifyText = '拖动滑块解锁';
this.getImg();
},
getImg () {
getImg () { // 获取验证图片
getVerifyImg(this.type).then(res => {
this.data = res.result;
});

View File

@@ -26,7 +26,3 @@ export function postVerifyImg (params) {
headers: {uuid: storage.getItem('uuid')}
});
}
export function mouseup () {
console.log(111);
}