修复切换登录状态后用户身份未更新的bug

This commit is contained in:
唐明明
2021-09-16 13:54:37 +08:00
parent b12465f611
commit 6a9b350413
14 changed files with 4555 additions and 4038 deletions

View File

@@ -3,12 +3,18 @@
<!-- 商品图片 -->
<view class="form-block">
<view class="form-upd">
<view class="form-title">商品轮播图<text>首图为产品封面</text></view>
<view class="form-title">商品轮播图<text>首图封面点击预览长按删除</text></view>
<view class="form-imgs">
<view class="item" v-for="(item, index) in cover" :key="index">
<image class="item-cover" src="@/static/dev/good_cover_00.jpg" mode="aspectFill"></image>
<view
class="item"
v-for="(item, index) in pictures"
:key="index"
@click="openImg(index, 'pictures')"
@longpress="removeImg(index, 'pictures')"
>
<image class="item-cover" :src="item.showpath" mode="aspectFill"></image>
</view>
<view class="item item-add">
<view class="item item-add" @click="updCover('pictures')">
<image class="item-cover" src="@/static/icons/add-icon.png" mode="aspectFill"></image>
</view>
</view>
@@ -17,50 +23,56 @@
<!-- 商品基本信息 -->
<view class="form-block">
<view class="form-box inputs-flex">
<label class="form-label">标题</label>
<label class="form-label">产品标题</label>
<input type="text" v-model="name" placeholder="输入商品标题"/>
</view>
<view class="form-box inputs-flex">
<label class="form-label">商品描述</label>
<input type="text" v-model="description" placeholder="输入商品描述"/>
</view>
<view class="form-box picker-flex">
<label class="form-label">产品详情</label>
<view class="picker-text">
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
<view class="form-box inputs-flex">
<label class="form-label">规格单位</label>
<input type="digit" :value="skus_unit" placeholder="输入规格单位 如:件"/>
</view>
<view class="form-upd">
<view class="form-title">商品详情点击预览长按删除</view>
<view class="form-imgs">
<view
class="item"
v-for="(item, index) in content"
:key="index"
@click="openImg(index, 'content')"
@longpress="removeImg(index, 'content')"
>
<image class="item-cover" :src="item.showpath" mode="aspectFill"></image>
</view>
<view class="item item-add" @click="updCover('content')">
<image class="item-cover" src="@/static/icons/add-icon.png" mode="aspectFill"></image>
</view>
</view>
</view>
</view>
<!-- 商品价格 -->
<view class="form-block">
<view class="form-box inputs-flex input-unit">
<label class="form-label">划线价</label>
<input type="digit" v-model="original_price" placeholder="0.00"/>
<text class="units">/</text>
</view>
<view class="form-box inputs-flex input-unit">
<label class="form-label">市场价格</label>
<input type="digit" v-model="skus_cost" placeholder="0.00"/>
<text class="units">/</text>
<text class="units">{{skus_unit != '' ? '/' + skus_unit : ''}}</text>
</view>
<view class="form-box inputs-flex input-unit">
<label class="form-label">销售价格</label>
<input type="digit" v-model="skus_price" placeholder="0.00"/>
<text class="units">/</text>
</view>
<view class="form-box inputs-flex input-unit">
<label class="form-label">资产</label>
<input type="digit" v-model="skus_assets" placeholder="0.00"/>
<text class="units">/</text>
<text class="units">{{skus_unit != '' ? '/' + skus_unit : ''}}</text>
</view>
<view class="form-box inputs-flex input-unit">
<label class="form-label">分销佣金</label>
<input type="digit" v-model="skus_charge" placeholder="0.00"/>
<text class="units">/</text>
<text class="units">{{skus_unit != '' ? '/' + skus_unit : ''}}</text>
</view>
</view>
<!-- 商品详情介绍 -->
<view class="form-block">
<!-- is_change query 0 是否支持易货 -->
<view class="form-box inputs-flex">
<label class="form-label">易货起购数量</label>
<input type="number" v-model="skus_number" placeholder="输入易货起购数量"/>
@@ -73,39 +85,37 @@
<!-- 售后服务 -->
<view class="form-block">
<view class="form-box picker-flex">
<label class="form-label">分类</label>
<picker mode="selector">
<view class="picker-text">
请选择分类
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
<label class="form-label">配送方式</label>
<view class="picker-text">
logistic_type 1.快递2.自提<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
<view class="form-box picker-flex">
<label class="form-label">支付方式</label>
<picker mode="selector">
<view class="picker-text">
请选择支付方式
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
<label class="form-label">关联店铺</label>
<view class="picker-text">
stores 自提必填<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
<view class="form-box picker-flex">
<label class="form-label">允许售后</label>
<picker mode="selector">
<view class="picker-text">
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
</view>
<view class="form-box picker-flex">
<label class="form-label">可选服务</label>
<view class="picker-text">
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
321321<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
</view>
<!-- 售后服务 -->
<view class="form-block">
<view class="form-box picker-flex">
<label class="form-label">到期时间</label>
<view class="picker-text">
321321<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
</view>
<!-- 可选服务 -->
<!-- 安全区 -->
<view class="ios-bottom"></view>
<!-- footer -->
@@ -117,25 +127,92 @@
</template>
<script>
import { managesGoodsCreate } from '@/apis/interfaces/goods'
import { managesGoodsCreate, managesCreate } from '@/apis/interfaces/goods'
import { uploads } from '@/apis/interfaces/uploading'
export default {
data() {
return {
cover : [],
name : '',
description : '',
original_price : '',
skus_cost : '',
skus_price : '',
skus_assets : '',
skus_charge : '',
skus_number : '',
skus_stock : '',
name : '', // 标题
pictures : [], // 轮播图
content : [], // 详情图
description : '', // 商品描述
isPostSale : false, // 是否允许售后
services : [], // 商品服务
skus_cost : '0.00',// 市场价格
skus_price : '0.00',// 销售价格
skus_number : 1, // 易货起购数量
skus_unit : '', // 规格文字
skus_charge : '0.00',// 分销佣金
skus_stock : 0, // 库存
isChange : false, // 是否支持易货
logisticType: 0, // 配送方式
stores : [], // 关联店铺
expiriedAt : '', // 活动到期时间
// 配置信息
storesArr : [], // 可选店铺
tags : [], // 可选商品标签
tagsIndex : 0, // 选择标签的下标
servicesArr : [], // 可选服务
type : 1, // 1为商品0为服务
};
},
created() {
managesCreate({
category_cid: 140
}).then(res => {
this.storesArr = res.stores
this.tags = res.tags
this.servicesArr= res.services
this.type = res.type
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods: {
// 图片预览
openImg(index, key){
let paths = this[key].map(val => {
return val.showpath
})
uni.previewImage({
urls : paths,
current : index,
indicator: 'number'
})
},
// 删除图片
removeImg(index, key){
this[key].splice(index, 1)
},
// 上传图片
updCover(key){
uni.chooseImage({
success : res => {
let path = res.tempFiles.map((val, index) => {
return {
name: 'uploads' + index,
uri : val.path
}
})
uploads(path).then(updRes => {
for(let i in updRes.path){
this[key].push({
path : updRes.path[i],
showpath: updRes.url[i]
})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
})
}
}
}
</script>

View File

@@ -1,19 +1,100 @@
<template>
<view>
发布分类
<view class="content-flex" v-if="!loding">
<scroll-view class="stair" scroll-y>
<view class="stair-item" :class="{'show': stairIndex == index}" v-for="(item, index) in category" :key="index" @click="stairIndex = index">{{item.name}}</view>
<view class="ios-bottom"></view>
</scroll-view>
<scroll-view class="second" scroll-y>
<view class="second-item" v-for="(item, index) in category[stairIndex].children" :key="index" @click="onCategory(item.category_id)">
{{item.name}}<uni-icons class="arrow-icon" type="arrowright" color="#999" size="14"></uni-icons>
</view>
<view class="ios-bottom"></view>
</scroll-view>
</view>
</template>
<script>
import { managesCategory } from '@/apis/interfaces/goods'
export default {
data() {
return {
loding : true,
category : [],
stairIndex : 0,
secondIndex : 0
};
},
created() {
managesCategory().then(res => {
this.loding = false
this.category = res
})
},
methods:{
// 选择分类
onCategory(id){
this.$Router.push({name: 'GoodsMagAdd', params: {id}})
}
}
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.content-flex{
background-color: white;
height: 100vh;
display: flex;
font-size: $title-size-m;
.stair{
background: #F5F5F5;
width: 240rpx;
.stair-item{
text-align: center;
padding: 0 $padding;
line-height: 90rpx;
color: $text-gray;
@extend .nowrap;
&.show{
position: relative;
background: white;
color: $text-price;
font-weight: bold;
&::before{
position: absolute;
height: 40rpx;
width: 5rpx;
background: $text-price;
content: " ";
left: 0;
top: 20rpx;
}
}
}
}
.second{
width: calc(100% - 240rpx);
.second-item{
position: relative;
padding: 0 ($padding + 80) 0 $padding;
line-height: 90rpx;
color: $text-gray;
.arrow-icon{
position: absolute;
right: $padding;
}
&::after{
position: absolute;
height: 1rpx;
content: ' ';
background: $border-color;
left: $padding;
right: 0;
top: 0;
}
&:first-child::after{
display: none;
}
}
}
}
</style>

View File

@@ -95,7 +95,7 @@
<image class="item-cover" src="@/static/icons/user_icon_03.png" mode="aspectFill"></image>
<view class="item-title">我的优惠券</view>
</view>
<view class="item">
<view class="item" @click="outLogin">
<image class="item-cover" src="@/static/icons/user_icon_04.png" mode="aspectFill"></image>
<view class="item-title">地址管理</view>
</view>
@@ -172,9 +172,9 @@
}
},
methods: {
// outLogin(){
// this.$store.commit('setToken', '')
// }
outLogin(){
this.$store.commit('setToken', '')
},
selectedBanner(item, index) {
console.log('🥒', item, index)
}

View File

@@ -89,6 +89,7 @@
return
}
index().then(res => {
this.certification = res.is_certification
if(!res.is_certification){
this.getAppliesQuery()
return
@@ -104,10 +105,10 @@
middle : res.middle,
order : res.order
}
this.certification = res.is_certification
this.employee = res.is_employee
this.loding = false
}).catch(err =>{
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
@@ -117,6 +118,7 @@
// 查询企业认证状态
getAppliesQuery(){
appliesQuery().then(res=>{
console.log(res)
this.appliesState = res
this.loding = false
}).catch(err => {