uniapp 会员权益判断

pull/2/head
Jruome 2023-05-23 18:08:01 +08:00
parent 9a6e45053c
commit f9c4d2b102
9 changed files with 167 additions and 150 deletions

View File

@ -3,7 +3,7 @@
v-if="dialogVisible"
title="运费模板"
:visible.sync="dialogVisible"
width="1000px"
width="70%"
:before-close="handleClose"
>
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" size="mini" v-if="dialogVisible" :rules="rules">
@ -140,9 +140,9 @@
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item v-if="ruleForm.noDelivery" class="noBox" prop="shippingTemplatesNoDeliveryRespVOS">
<el-form-item v-if="ruleForm.noDelivery" class="noBox" prop="noRegion">
<el-cascader
v-model="ruleForm.shippingTemplatesNoDeliveryRespVOS"
v-model="ruleForm.noRegion"
placeholder="请选择不配送区域"
:options="cityList"
:props="props"
@ -183,7 +183,7 @@ const defaultRole = {
noDelivery: false,
free: [],
undelives: {},
shippingTemplatesNoDeliveryRespVOS: []
noRegion: []
}
const kg = '重量kg'
const m = '体积'
@ -230,7 +230,7 @@ export default {
region: [
{ required: true, message: '请选择活动区域', trigger: 'change' }
],
shippingTemplatesNoDeliveryRespVOS: [
noRegion: [
{ type: 'array', required: true, message: '请至少选择一个地区', trigger: 'change' }
],
first: [
@ -302,7 +302,7 @@ export default {
noDelivery: false,
free: [],
undelives: {},
shippingTemplatesNoDeliveryRespVOS: []
noRegion: []
}
},
changeRegion(value) {
@ -442,36 +442,60 @@ export default {
// shippingTemplatesNoDeliveryRespVOS: []
}
this.ruleForm.region.forEach((el, index) => {
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
if(el.city_ids.length > 0){
el.cityId = el.city_ids.map(item => {
return item[2]
}).join(',')
}else{
el.cityId = 'all'
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesRegionRespVOList = this.ruleForm.region
param.shippingTemplatesRegionRespVOList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
// this.ruleForm.region.forEach((el, index) => {
// el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
// for (var i = 0; i < el.city_ids.length; i++) {
// el.city_ids[i].shift()
// }
// el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
// })
// param.shippingTemplatesRegionRespVOList = this.ruleForm.region
// param.shippingTemplatesRegionRespVOList.forEach((el, index) => {
// // delete el.city_ids
// // delete el.city_id
// })
if (this.ruleForm.appoint) {
this.ruleForm.free.forEach((el, index) => {
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
if(el.city_ids.length > 0){
el.cityId = el.city_ids.map(item => {
return item[2]
}).join(',')
}else{
el.cityId = 'all'
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesFreeRespVOList = this.ruleForm.free
param.shippingTemplatesFreeRespVOList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
// this.ruleForm.free.forEach((el, index) => {
// el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
// for (var i = 0; i < el.city_ids.length; i++) {
// el.city_ids[i].shift()
// }
// el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
// })
// param.shippingTemplatesFreeRespVOList = this.ruleForm.free
// param.shippingTemplatesFreeRespVOList.forEach((el, index) => {
// // delete el.city_ids
// // delete el.city_id
// })
}
if (this.ruleForm.noDelivery) {
param.shippingTemplatesNoDeliveryRespVOS = this.ruleForm.shippingTemplatesNoDeliveryRespVOS.map(a => {
console.log(a)
return a.slice(1, 3).join(',')
}).join(',')
param.shippingTemplatesNoDeliveryRespVOS = [{
cityId:[],
}]
this.ruleForm.noRegion.forEach((item,index) => {
param.shippingTemplatesNoDeliveryRespVOS[0].cityId.push(item[2])
})
param.shippingTemplatesNoDeliveryRespVOS[0].cityId = param.shippingTemplatesNoDeliveryRespVOS[0].cityId.join(",")
}
if (this.type === 0) {
logistics.shippingSave(param).then(res => {

View File

@ -31,15 +31,6 @@
id: 0
},
onLaunch: function(option) {
// const res = memberGradeInfo().then((res) =>{
// if(res.data.some((item) => !!parseInt(item.isExist))){
// uni.setTabBarItem({
// index: 2,
// pagePath: '/pages/member_equity/index'
// })
// }
// })
let that = this;
// #ifdef H5
uni.getSystemInfo({
@ -258,7 +249,17 @@
});
}
},
onShow: function() {
onShow:async function() {
// const res = await memberGradeInfo()
// if(res.data.some((item) => !!parseInt(item.isExist))){
// uni.setTabBarItem({
// index: 0,
// pagePath: '/pages/member_equity/index'
// })
// uni.switchTab({
// url:'/pages/member_equity/index'
// })
// }
// #ifdef H5
uni.getSystemInfo({
success(e) {

View File

@ -5,7 +5,7 @@ import request from "@/utils/request.js";
* @param numType boolean true 购物车数量,false=购物车产品数量
*/
export function getCartCounts(numType,type) {
return request.get("cart/count?numType=" + numType + "&type=" + type);
return request.get("front/cart/count?numType=" + numType + "&type=" + type);
}
/**
* 获取购物车列表
@ -243,7 +243,7 @@ export function applyRefund(orderId) {
* @param object data
*/
export function preOrderApi(data) {
return request.post(`order/pre/order`, data);
return request.post(`front/order/pre/order`, data);
}
/**

View File

@ -6,7 +6,7 @@ import request from "@/utils/request.js";
*
*/
export function getProductDetail(id, type) {
return request.get('product/detail/' + id + '?type=' + type, {}, {
return request.get('front/product/detail/' + id + '?type=' + type, {}, {
noAuth: true
});
}
@ -17,12 +17,12 @@ export function getProductDetail(id, type) {
*/
// #ifndef MP
export function getProductCode(id) {
return request.get('product/code/' + id, {});
return request.get('front/product/code/' + id, {});
}
// #endif
// #ifdef MP
export function getProductCode(id) {
return request.get('product/code/' + id, {
return request.get('front/product/code/' + id, {
user_type: 'routine'
});
}
@ -34,7 +34,7 @@ export function getProductCode(id) {
* @param string category product=普通产品,product_seckill=秒杀产品
*/
export function collectAdd(id, category) {
return request.post('collect/add', {
return request.post('front/collect/add', {
id: id,
'category': category === undefined ? 'product' : category
});
@ -62,7 +62,7 @@ export function collectDelete(ids) {
*
*/
export function postCartAdd(data) {
return request.post('cart/save', data, {});
return request.post('front/cart/save', data, {});
}
/**
@ -146,7 +146,7 @@ export function getReplyList(id, data) {
* @param int id
*/
export function getReplyConfig(id) {
return request.get('reply/config/' + id,{},{
return request.get('front/reply/config/' + id,{},{
noAuth: true
});
}
@ -175,7 +175,7 @@ export function storeListApi(data) {
* @param object data
*/
export function getProductGood() {
return request.get('product/good');
return request.get('front/product/good');
}
/**
@ -185,7 +185,7 @@ export function getProductGood() {
*
*/
export function getReplyProduct(id) {
return request.get('reply/product/' + id, {
return request.get('front/reply/product/' + id, {
noAuth: true
})
}

View File

@ -1,51 +1,8 @@
{
"name": "yudao-ui-app",
"version": "1.0.0",
"lockfileVersion": 2,
"lockfileVersion": 1,
"requires": true,
"packages": {
"": {
"name": "yudao-ui-app",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"clipboard": "^2.0.11"
}
},
"node_modules/clipboard": {
"version": "2.0.11",
"resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
"dependencies": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"node_modules/delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"node_modules/good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
"dependencies": {
"delegate": "^3.1.2"
}
},
"node_modules/select": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
},
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
}
},
"dependencies": {
"clipboard": {
"version": "2.0.11",

View File

@ -574,34 +574,41 @@
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/images/tabbar/nav_icon_shop.png",
"selectedIconPath": "static/images/tabbar/nav_icon_shop_active.png",
"text": "商城"
},
{
"pagePath": "pages/goods_cate/goods_cate",
"iconPath": "static/images/tabbar/nav_icon_sort.png",
"selectedIconPath": "static/images/tabbar/nav_icon_sort_active.png",
"text": "分类"
},
// {
// "pagePath": "pages/index/index",
// "iconPath": "static/images/tabbar/nav_icon_shop.png",
// "selectedIconPath": "static/images/1-002.png",
// "text": "商城"
// },
// {
// "pagePath": "pages/goods_cate/goods_cate",
// "iconPath": "static/images/tabbar/nav_icon_sort.png",
// "selectedIconPath": "static/images/2-002.png",
// "text": "分类"
// },
{
"pagePath": "pages/member_application/index",
"iconPath": "static/images/tabbar/nav_icon_member.png",
"iconPath": "static/images/2-001.png",
"selectedIconPath": "static/images/tabbar/nav_icon_member_active.png",
"text": "会员申请"
},
{
"pagePath": "pages/order_addcart/order_addcart",
"iconPath": "static/images/tabbar/nav_icon_cart.png",
"selectedIconPath": "static/images/tabbar/nav_icon_cart_active.png",
"text": "购物车"
"pagePath": "pages/member_equity/index",
"iconPath": "static/images/2-001.png",
"selectedIconPath": "static/images/tabbar/nav_icon_member_active.png",
"text": "会员申请",
"visible":false
},
// {
// "pagePath": "pages/order_addcart/order_addcart",
// "iconPath": "static/images/tabbar/nav_icon_cart.png",
// "selectedIconPath": "static/images/3-002.png",
// "text": "购物车"
// },
{
"pagePath": "pages/user/index",
"iconPath": "static/images/tabbar/nav_icon_my.png",
"selectedIconPath": "static/images/tabbar/nav_icon_my_active.png",
"selectedIconPath": "static/images/4-002.png",
"text": "我的"
}
]

View File

@ -90,7 +90,7 @@
</view>
<view class='iconfont icon-jiantou'></view>
</view>
<view class='userEvaluation' id="past1">
<!-- <view class='userEvaluation' id="past1">
<view class='title acea-row row-between-wrapper'
:style="replyCount==0?'border-bottom-left-radius:14rpx;border-bottom-right-radius:14rpx;':''">
<view>用户评价<i>({{replyCount}})</i></view>
@ -103,7 +103,7 @@
<block v-if="replyCount">
<userEvaluation :reply="reply"></userEvaluation>
</block>
</view>
</view> -->
<!-- 优品推荐 -->
<view class="superior borRadius14" if='good_list.length' id="past2">
<view class="title acea-row row-center-wrapper">

View File

@ -115,6 +115,14 @@
uni.switchTab({
url:'/pages/member_equity/index'
})
}else{
uni.setTabBarItem({
index: 0,
pagePath: '/pages/member_application/index'
})
uni.switchTab({
url:'/pages/member_application/index'
})
}
this.memberData = res.data
} finally{

View File

@ -62,7 +62,8 @@
<script>
import {
memberHeadInfo
memberHeadInfo,
memberGradeInfo
} from '@/api/member.js';
import {
mapGetters
@ -89,6 +90,25 @@
},
computed: mapGetters(['userInfo']),
async onLoad() {
const resful = await memberGradeInfo()
if(resful.data.some((item) => !!parseInt(item.isExist))){
uni.setTabBarItem({
index: 0,
pagePath: '/pages/member_equity/index'
})
uni.switchTab({
url:'/pages/member_equity/index'
})
}else{
uni.setTabBarItem({
index: 0,
pagePath: '/pages/member_application/index'
})
uni.switchTab({
url:'/pages/member_application/index'
})
}
const res = await memberHeadInfo()
this.memberDetail = res.data
},