This commit is contained in:
曹辉 2023-01-29 10:42:34 +08:00
parent 4d98d05062
commit 9f29e72035
10 changed files with 288 additions and 49 deletions

View File

@ -1,8 +1,16 @@
import request from "../request.js"
export function goodsList(pageSize,pageNum,goodsCategoryId,goodsName) {
export function goodsList(pageSize, pageNum, goodsCategoryId, goodsName) {
return request({
url: `/nurseApplet/nursingStationGoods/goodsList?pageSize=${pageSize}&pageNum=${pageNum}&goodsCategoryId=${goodsCategoryId}&goodsName=${goodsName}`,
method: 'GET'
})
}
}
//查询商品分类二级分类上边列表 小程序
export function getGoodsCategoryNameList(goodsCategoryId) {
return request({
url: `/nurseApplet/nursingStationGoods/getGoodsCategoryNameList?goodsCategoryId=${goodsCategoryId}`,
method: 'GET'
})
}

View File

@ -1,8 +1,8 @@
import request from "../request.js"
export function goodsCategoryList(pageSize,pageNum) {
export function goodsCategoryList(pageSize, pageNum) {
return request({
url: `/nurseApplet/nursingStationGoods/goodsCategoryList?pageSize=${pageSize}&pageNum=${pageNum}`,
url: `/nurseApplet/nursingStationGoods/goodsCategoryList?pageSize=${pageSize}&pageNum=${pageNum}&categoryLevel=${1}`,
method: 'GET'
})
}

View File

@ -332,7 +332,16 @@
"navigationBarBackgroundColor": "#ffffff"
}
}
],
,{
"path" : "pages/toptabbar/toptabbar",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",

View File

@ -1,5 +1,8 @@
<template>
<view class="app">
<top-tabbar :tabIndex="tabIndex" :tabBars="GoodsCategorychildrenlist" @toggleToptab="toggleTab"
selectedBottomColor="#30c58d" selectedTextColor="#343434" textColor="#7d7e80" bgColor="#ffffff">
</top-tabbar>
<view class="inputs">
<i class="icon"></i>
<input v-model="goodsName" type="text" name="" id="" class="input" placeholder="请输入商品名称">
@ -31,12 +34,19 @@
<script>
import {
goodsList
goodsList,
getGoodsCategoryNameList
} from '@/api/ProductList/ProductList.js';
import baseurl from '@/api/baseurl.js'
import topTabbar from '../toptabbar/toptabbar.vue'
export default {
components: {
topTabbar
},
data() {
return {
//tabIndex便
tabIndex: 0,
baseurl: '',
title: '医路优品', //
pageNum: 1,
@ -45,6 +55,8 @@
goodsList: [], //list
total: 0, //list
goodsName: '',
GoodsCategorychildrenlist: [], //list
GoodsCategorychildrenid: null,
};
},
watch: { //
@ -60,14 +72,12 @@
var that = this
try {
const value = uni.getStorageSync('openid');
const value3 = uni.getStorageSync('Refresh');
if (value) {} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} catch (e) {}
try {
const value3 = uni.getStorageSync('Refresh');
if (value3) {
that.goodsListinfo();
}
@ -78,10 +88,52 @@
this.title = options.title //
}
this.goodsCategoryId = options.goodsCategoryId //id
this.GoodsCategorychildrenid = options.goodsCategoryId //id
this.baseurl = baseurl;
this.goodsListinfo()
this.GoodsCategorychildren(this.goodsCategoryId);
},
methods: {
//
toggleTab(index) {
if (index == 1111111111111) {} else if (index == 0) {
this.GoodsCategorychildrenid = this.goodsCategoryId
this.tabIndex = index
this.pageNum = 1
goodsList(this.pageSize, this.pageNum, this.goodsCategoryId, this.goodsName).then(
res => {
if (res.code == 200) {
this.goodsList = res.rows
this.total = res.total
}
uni.removeStorageSync('Refresh');
})
} else {
this.GoodsCategorychildrenid = this.GoodsCategorychildrenlist[index].id
this.tabIndex = index
this.pageNum = 1
goodsList(this.pageSize, this.pageNum, this.GoodsCategorychildrenid, this.goodsName).then(
res => {
if (res.code == 200) {
this.goodsList = res.rows
this.total = res.total
}
uni.removeStorageSync('Refresh');
})
}
},
//id
GoodsCategorychildren(value) {
getGoodsCategoryNameList(value).then(res => {
this.GoodsCategorychildrenlist = [{
goodsCategoryName: '全部',
id: 99999999999999999,
}]
res.data.forEach(e => {
this.GoodsCategorychildrenlist.push(e)
})
})
},
//
goodsListinfo() {
this.pageNum = 1;
@ -110,7 +162,7 @@
onReachBottom() { //
if (this.goodsList.length >= this.total) {} else {
this.pageNum++;
goodsList(this.pageSize, this.pageNum, this.goodsCategoryId, this.goodsName).then(res => {
goodsList(this.pageSize, this.pageNum, this.GoodsCategorychildrenid, this.goodsName).then(res => {
if (res.code == 200) {
res.rows.forEach(e => {
this.goodsList.push(e)
@ -121,7 +173,7 @@
},
onPullDownRefresh() { //
this.pageNum = 1;
goodsList(this.pageSize, this.pageNum, this.goodsCategoryId, this.goodsName).then(res => {
goodsList(this.pageSize, this.pageNum, this.GoodsCategorychildrenid, this.goodsName).then(res => {
this.goodsList = res.rows
this.total = res.total
})
@ -229,7 +281,7 @@
.text {
font-size: 24rpx;
padding: 0 15rpx;
padding: 0 15rpx;
// text-overflow: ellipsis;
// overflow: hidden;
// white-space: nowrap;
@ -251,7 +303,7 @@
}
image {
border-radius: 25rpx 25rpx 0 0 ;
border-radius: 25rpx 25rpx 0 0;
width: 100%;
height: 340rpx;
}

View File

@ -176,6 +176,9 @@
display: inline-block;
height: 120rpx;
line-height: 120rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
span {

View File

@ -28,11 +28,8 @@
<view class="address" style="">
{{query.locationName}}
</view>
<!-- <u-input type="text" placeholder='' /> -->
</view>
</view>
<!-- <u-select v-model="areashow" mode="mutil-column-auto" label-name='areaName' value-name='areaCode'
:list="arealist" @confirm="areaconfirm"></u-select> -->
<view class="">
<m-city style='z-index: 10076;' :provinceData="list" headTitle="地区选择" ref="cityPicker"
@funcValue="getpickerParentValue" pickerSize="4">
@ -322,10 +319,6 @@
}
})
},
onUnload() {
// nullgeLocation
// chooseLocation.setLocation(null);
},
}
</script>
<style lang="scss">

View File

@ -91,6 +91,8 @@
var list = null
if (this.tabbars[this.tabbars.length - 1].localName == '请选择') {
list = this.tabbars.filter(e => e.localName != '请选择')
} else {
list = this.tabbars
}
this.$emit("funcValue", list);
this.hide();

View File

@ -167,25 +167,33 @@
//
getpickerParentValue(e) {
this.addresslength = e
if (e) {
if (e.length == 4) {
this.infolist.address = e[0].localName + '-' + e[1].localName + '-' + e[2].localName + '-' + e[3]
.localName
this.infolist.areaCode = e[3].id
} else if (e.length == 3) {
this.infolist.address = e[0].localName + '-' + e[1].localName + '-' + e[2].localName
this.infolist.areaCode = e[2].id
} else if (e.length == 2) {
this.infolist.address = e[0].localName + '-' + e[1].localName
this.infolist.areaCode = e[1].id
} else if (e.length == 1) {
this.infolist.address = e[0].localName
this.infolist.areaCode = e[0].id
} else {
this.infolist.address = ''
this.infolist.areaCode = ''
}
this.infolist.address = ''
this.infolist.areaCode = ''
if (e && e.length >= 1) {
e.forEach(el => {
this.infolist.address = this.infolist.address + el.localName
})
this.infolist.areaCode = e[e.length - 1].id
}
// if (e) {
// if (e.length == 4) {
// this.infolist.address = e[0].localName + '-' + e[1].localName + '-' + e[2].localName + '-' + e[3]
// .localName
// this.infolist.areaCode = e[3].id
// } else if (e.length == 3) {
// this.infolist.address = e[0].localName + '-' + e[1].localName + '-' + e[2].localName
// this.infolist.areaCode = e[2].id
// } else if (e.length == 2) {
// this.infolist.address = e[0].localName + '-' + e[1].localName
// this.infolist.areaCode = e[1].id
// } else if (e.length == 1) {
// this.infolist.address = e[0].localName
// this.infolist.areaCode = e[0].id
// } else {
// this.infolist.address = ''
// this.infolist.areaCode = ''
// }
// }
},
//
showPicker() {
@ -324,19 +332,15 @@
this.shipAddress = '修改地址'
this.isedit = false
nursingStationGoodsinfo(item.id).then(res => {
this.infolist = res.data
getSubordinate(res.data.areaCode).then(res => {
if (res.data.streetName) {
this.infolist.address = res.data.provinceName + '-' + res.data.cityName +
'-' +
res
.data.regionName + '-' + res.data.streetName
getSubordinate(res.data.areaCode).then(resp => {
if (resp.data.streetName) {
res.data.address = resp.data.provinceName + resp.data.cityName + resp.data
.regionName + resp.data.streetName
} else {
this.infolist.address = res.data.provinceName + '-' + res.data.cityName +
'-' +
res
.data.regionName
res.data.address = resp.data.provinceName + resp.data.cityName + resp.data
.regionName
}
this.infolist = res.data
this.show = true
})
})

View File

@ -0,0 +1,168 @@
<template>
<view style="position: relative;">
<!--顶部导航栏-->
<view class="uni-top-tabbar">
<scroll-view scroll-x="true" class="uni-swiper-tab" :style="{backgroundColor:bgColor}">
<view v-for="(tabBar,index) in tabBars" :key="index" class="swiper-tab-list"
:class="{'active': tabIndex==index}" :style="{color:tabIndex==index?selectedTextColor:textColor}"
@tap="toggleTab(index)">
<view class="title">
{{tabBar.goodsCategoryName}}
</view>
<view class="swiper-tab-line"
:style="{backgroundColor:tabIndex==index?selectedBottomColor:bgColor}"></view>
</view>
</scroll-view>
<view class="fenlei" @tap='toggleTab(1111111111111)'>
<image src="../../static/fenlei.png" mode=""></image>
<view class="">
分类
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "topTabbar",
props: {
//
tabIndex: {
type: Number,
default: 0
},
//
tabBars: {
type: Array,
default: [{
goodsCategoryName: '标签1',
id: 1
},
{
goodsCategoryName: '标签2',
id: 2
},
{
goodsCategoryName: '标签3',
id: 3
},
{
goodsCategoryName: '标签4',
id: 4
},
{
goodsCategoryName: '标签5',
id: 5
},
{
goodsCategoryName: '标签6',
id: 6
}
]
},
//
selectedBottomColor: {
type: String,
default: '#30c58d'
},
//
bgColor: {
type: String,
default: '#ffffff'
},
//
selectedTextColor: {
type: String,
default: '#343434'
},
//
textColor: {
type: String,
default: '#7d7e80'
}
},
data() {
return {}
},
methods: {
//
toggleTab(index) {
console.log(index)
this.$emit("toggleToptab", index)
}
}
}
</script>
<style lang="scss">
.fenlei {
width: 25%;
display: inline-block;
background-color: #fff;
line-height: 70rpx;
font-weight: normal;
height: 75rpx;
text-align: center;
color: #7d7e80;
position: absolute;
right: 0;
top: 0;
view {
position: absolute;
right: 25%;
}
image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 25%;
top: 50%;
transform: translateY(-55%);
}
}
.title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
.uni-top-tabbar {
/* 以下3项设置用于开启底部阴影显示 */
/* position: relative;
z-index: 1;
overflow: visible; */
width: 75%;
.uni-swiper-tab {
height: 75rpx;
//
//box-shadow: rgba(170, 170, 170, 0.5) 0 2rpx 8rpx 0;
white-space: nowrap;
.swiper-tab-list {
font-size: 28rpx;
font-weight: normal;
line-height: 70rpx;
//
width: 25%;
text-align: center;
display: inline-block;
}
.active {
.swiper-tab-line {
height: 4rpx;
width: 80rpx;
margin: auto;
}
}
}
}
</style>

BIN
static/fenlei.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB