Commit 02d86a73 by LJM

兼容

parent c1a412d0
/.idea
/.hbuilderx
/unpackage
/unpackage/*
/*.hbuilderx
/.DS_Store
/node_modules
\ No newline at end of file
<template>
<view class="userInfoPage" >
<view class="userInfoPage">
<barX />
<view class="head" v-if="userinfo">
......@@ -9,24 +9,24 @@
</view>
<view class="cen row">
<view class="imgh">
<image @click="chooseImageChange" :src="userinfo.avatar_url?userinfo.avatar_url:'https://img.ichunt.com/images/ichunt/202502/24/e3f1f226b93f791de65faf46be2cdf9f.png'"/>
<image @click="chooseImageChange" :src="userinfo.avatar_url?userinfo.avatar_url:'https://img.ichunt.com/images/ichunt/202502/24/e3f1f226b93f791de65faf46be2cdf9f.png'" />
</view>
<view>
<view class="namen">{{userinfo.wx_nickname||userinfo.phone||userinfo.email||'微信用户'}}</view>
<navigator :url="'/pages/user/companyInfo?id='+companyId">
<view class="com row verCenter" v-if="certification.length>0">
<view >{{userinfo.company_name}}</view>
<image src="https://img.ichunt.com/images/ichunt/202502/24/71bb98554d41d147323089e464079a28.png"/>
<view>{{userinfo.company_name}}</view>
<image src="https://img.ichunt.com/images/ichunt/202502/24/71bb98554d41d147323089e464079a28.png" />
<text class="icon iconfont icon-arrowright"></text>
</view>
<view class="com row verCenter di" v-else>
<view >暂无公司信息</view>
<image src="https://img.ichunt.com/images/ichunt/202502/24/00d5a3c2e0a057075b618a2da69978da.png"/>
<view>暂无公司信息</view>
<image src="https://img.ichunt.com/images/ichunt/202502/24/00d5a3c2e0a057075b618a2da69978da.png" />
<text class="grz">去认证<text class="icon iconfont icon-arrowright"></text></text>
</view>
</navigator>
<navigator url="/pages/user/coupon" >
<navigator url="/pages/user/coupon">
<view class="coup-box row verCenter">
优惠券:<text class="tops">{{couponCount}}</text> 张未使用
<text class="icon iconfont icon-arrowright"></text>
......@@ -50,28 +50,28 @@
</view>
<view class="order-status row bothSide">
<navigator url="/pages/user/orderList?status=1" class="yhq">
<image src="https://img.ichunt.com/images/ichunt/202502/24/d70205f2f83cead903cca76bde50db17.png"/>
<image src="https://img.ichunt.com/images/ichunt/202502/24/d70205f2f83cead903cca76bde50db17.png" />
<view>待确认</view>
<text class="count" v-if="orderCount['1']>0">{{orderCount['1']}}</text>
</navigator>
<navigator url="/pages/user/orderList?status=2,3" class="yhq">
<image src="https://img.ichunt.com/images/ichunt/202502/24/1fe54495f0fdfb72f8126daee9d5564f.png"/>
<image src="https://img.ichunt.com/images/ichunt/202502/24/1fe54495f0fdfb72f8126daee9d5564f.png" />
<view>待付款</view>
<text class="count" v-if="(orderCount['2']+orderCount['3'])>0">{{orderCount['2']+orderCount['3']}}</text>
</navigator>
<navigator url="/pages/user/orderList?status=4" class="yhq">
<image src="https://img.ichunt.com/images/ichunt/202502/24/4de1203f3ddb51a020c0ab53bd2ee3b5.png"/>
<image src="https://img.ichunt.com/images/ichunt/202502/24/4de1203f3ddb51a020c0ab53bd2ee3b5.png" />
<view>待发货</view>
<text class="count" v-if="orderCount['4']>0">{{orderCount['4']}}</text>
</navigator>
<navigator url="/pages/user/orderList?status=7,8" class="yhq">
<image src="https://img.ichunt.com/images/ichunt/202502/24/986cd7e0d070537db3767503d85084c9.png"/>
<image src="https://img.ichunt.com/images/ichunt/202502/24/986cd7e0d070537db3767503d85084c9.png" />
<view>待收货</view>
<text class="count" v-if="(orderCount['7']+orderCount['8'])>0">{{orderCount['7']+orderCount['8']}}</text>
</navigator>
<navigator url="/pages/user/orderList?status=-1,10" class="yhq">
<image src="https://img.ichunt.com/images/ichunt/202502/24/d75f5fe63ec44f624c0289ca2c4821a5.png"/>
<image src="https://img.ichunt.com/images/ichunt/202502/24/d75f5fe63ec44f624c0289ca2c4821a5.png" />
<view>已完结</view>
<text class="count" v-if="(orderCount['-1']+orderCount['10'])>0">{{orderCount['-1']+orderCount['10']}}</text>
</navigator>
......@@ -112,20 +112,20 @@
export default {
data() {
return {
isInit:false,
couponCount:0,
certification:[],
userinfo:JSON.parse(uni.getStorageSync('user_info')),
companyId:"",
orderCount:{
"1":0,
"2":0,
"3":0,
"4":0,
"7":0,
"8":0,
"10":0,
"-1":0
isInit: false,
couponCount: 0,
certification: [],
userinfo: uni.getStorageSync('user_info') ? JSON.parse(uni.getStorageSync('user_info')) : '',
companyId: "",
orderCount: {
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"7": 0,
"8": 0,
"10": 0,
"-1": 0
}
}
},
......@@ -137,21 +137,21 @@
this.getInfo();
},
methods: {
getInfo(){
getInfo() {
//获取用户信息
this.request(Api_Url + '/api/user/info', 'GET', {}, (this.isInit?false:true)).then(res => {
this.isInit=true
this.request(Api_Url + '/api/user/info', 'GET', {}, (this.isInit ? false : true)).then(res => {
this.isInit = true
if (res.code == 0) {
this.certification=res.data.certification||[]
this.certification = res.data.certification || []
this.userinfo=res.data.userinfo
this.userinfo = res.data.userinfo
uni.setStorageSync('user_info', JSON.stringify(this.userinfo));
this.certification.forEach(item=>{
if(item.com_name==this.userinfo.company_name){
this.companyId=item.id
this.certification.forEach(item => {
if (item.com_name == this.userinfo.company_name) {
this.companyId = item.id
}
})
}else{
} else {
uni.showToast({
title: res.msg,
icon: 'none'
......@@ -160,7 +160,7 @@
});
},
chooseImageChange(){
chooseImageChange() {
uni.chooseImage({
count: 1, // 限制选择一张图片
sizeType: ['original', 'compressed'], // 选择原图或压缩图
......@@ -168,25 +168,25 @@
success: (res) => {
const tempFilePath = res.tempFilePaths[0]; // 获取临时文件路径
uni.uploadFile({
url: Api_Url+'/api/upload/uploadFile', // 替换为你的上传接口地址
url: Api_Url + '/api/upload/uploadFile', // 替换为你的上传接口地址
filePath: tempFilePath,
name: 'file', // 后端接收的字段名
formData: {
// 'user': 'test', // 可选,附加的表单数据
},
success: (uploadRes) => {
let resP=JSON.parse(uploadRes.data)
if(resP.code==0){
let resP = JSON.parse(uploadRes.data)
if (resP.code == 0) {
uni.showToast({
title: '上传成功',
icon: 'success'
});
this.request(Api_Url + '/api/user/editAvatar', 'POST', {url:resP.data.show_url}, false).then(resg => {
if(resg.code==0){
this.request(Api_Url + '/api/user/editAvatar', 'POST', { url: resP.data.show_url }, false).then(resg => {
if (resg.code == 0) {
this.getInfo();
}
});
}else{
} else {
uni.showToast({
title: resP.msg,
icon: 'success'
......@@ -198,11 +198,11 @@
}
});
},
getData(){
getData() {
//获取优惠券
this.request(Api_Url + '/api/coupon/getList', 'GET', {status:-1}, true).then(res => {
this.request(Api_Url + '/api/coupon/getList', 'GET', { status: -1 }, true).then(res => {
if (res.code == 0) {
this.couponCount=res.data.count['-1']||0
this.couponCount = res.data.count['-1'] || 0
}
});
......@@ -210,7 +210,7 @@
//获取订单信息
this.request(Api_Url + '/api/order/count', 'GET', {}, true).then(res => {
if (res.code == 0) {
this.orderCount={...res.data}
this.orderCount = { ...res.data }
}
});
......
......@@ -9,7 +9,7 @@ const _sfc_main = {
isInit: false,
couponCount: 0,
certification: [],
userinfo: JSON.parse(common_vendor.index.getStorageSync("user_info")),
userinfo: common_vendor.index.getStorageSync("user_info") ? JSON.parse(common_vendor.index.getStorageSync("user_info")) : "",
companyId: "",
orderCount: {
"1": 0,
......
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