完善商品分类及商品管理
This commit is contained in:
@ -18,33 +18,38 @@
|
||||
<scroll-view style="height: 100%" scroll-y="true" scroll-with-animation="true" @scrolltolower="getGoodsSearchFun">
|
||||
<view class="main-wrap">
|
||||
<view class="goods">
|
||||
<view class="u-m-t-32 bold-600">{{cateName}}</view>
|
||||
<view class="u-p-t-32 bold-600">{{cateName}}</view>
|
||||
|
||||
<view class="u-m-t-32">
|
||||
<view class="bg-white br16 row u-col-top u-m-b-24" v-for="(item, index) in 10" :key="index" @click="toShop()">
|
||||
<view class="u-p-t-32">
|
||||
<navigator hover-class="none" class="bg-white br16 row u-col-top u-m-b-24" v-for="(item, index) in goodsList" :key="index" @click="toShop()">
|
||||
<view>
|
||||
<u-image :src="cloudPath + 'img/banner.png'" width="136" height="136" border-radius="16"></u-image>
|
||||
<u-image :src="item.image" width="136" height="136" border-radius="16"></u-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view>
|
||||
<view class="u-line-2 u-p-t-10">葱烩海鲜卷边披萨</view>
|
||||
<view class="u-p-t-44 row-between">
|
||||
<view class="u-line-2 u-p-t-10">{{item.name}}</view>
|
||||
<view class="u-p-t-20 row-between">
|
||||
<view class="row">
|
||||
<view class="primary">
|
||||
<price-format :price="12.9" :subscriptSize="22" :firstSize="34" :secondSize="26"></price-format>
|
||||
<price-format :price="item.price" :subscriptSize="22" :firstSize="34" :secondSize="26"></price-format>
|
||||
</view>
|
||||
<view class="u-m-l-8">
|
||||
<price-format :lineThrough="true" color="#C0C0C0" :subscriptSize="22" :firstSize="22" :secondSize="22" :price="16.9"></price-format>
|
||||
<price-format :price="item.market_price" :lineThrough="true" color="#C0C0C0" :subscriptSize="22" :firstSize="22" :secondSize="22"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="column-end">
|
||||
<view class="column-end" @click.stop="count++">
|
||||
<u-icon name="plus-circle-fill" color="#254062" size="48"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
|
||||
<loading-footer :status="status" :slot-empty="true">
|
||||
<view slot="empty" class="column-center" style="padding: 200rpx 0 0">
|
||||
<text class="lighter sm">暂无商品</text>
|
||||
</view>
|
||||
</loading-footer>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -54,8 +59,10 @@
|
||||
<view class="buy mx40 px40 br60 row-between">
|
||||
<view class="row">
|
||||
<view class="u-relative">
|
||||
<u-image :src="cloudPath + 'img/icon_cart.png'" width="56" height="56"></u-image>
|
||||
<u-badge type="error" count="7" :absolute="true" offset="[0, 0]"></u-badge>
|
||||
<u-image :src="cloudPath + 'img/icon_cart.png'" width="80" height="80"></u-image>
|
||||
<view class="u-absolute top-0 right-0 text-fff number u-text-center xxs" v-if="buyNumber">
|
||||
{{ buyNumber }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-fff u-m-l-32">未选购商品</view>
|
||||
</view>
|
||||
@ -100,6 +107,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
loadingFun
|
||||
} from '@/utils/tools'
|
||||
import {
|
||||
getGoodsSearch,
|
||||
} from '@/api/store';
|
||||
import {
|
||||
loadingType
|
||||
} from '@/utils/type';
|
||||
|
||||
export default {
|
||||
name: "cate-one",
|
||||
props: {
|
||||
@ -110,46 +127,63 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page:1,
|
||||
status: loadingType.LOADING,
|
||||
selectIndex: 0,
|
||||
cateList: [],
|
||||
goodsList: [],
|
||||
cateName: '',
|
||||
numberVal: 1,
|
||||
showCart: false,
|
||||
showSpec: false,
|
||||
count: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeActive(index) {
|
||||
const {cateList} = this
|
||||
this.selectIndex = index
|
||||
const {
|
||||
cateList
|
||||
} = this
|
||||
this.cateName = cateList[index].name
|
||||
// this.onRefresh()
|
||||
this.selectIndex = index
|
||||
this.onRefresh()
|
||||
},
|
||||
|
||||
onRefresh() {
|
||||
this.page = 1
|
||||
this.goodsList = []
|
||||
this.status = loadingType.LOADING
|
||||
this.$nextTick(() => {
|
||||
this.getGoodsSearchFun();
|
||||
});
|
||||
},
|
||||
|
||||
async getGoodsSearchFun() {
|
||||
// let {
|
||||
// page,
|
||||
// goodsList,
|
||||
// priceSort,
|
||||
// saleSort,
|
||||
// status,
|
||||
// cateList,
|
||||
// selectIndex
|
||||
// } = this;
|
||||
// const item = cateList[selectIndex]
|
||||
// if(item.type == 0) return
|
||||
// if (status == loadingType.FINISHED) return;
|
||||
// const params = {
|
||||
// category_id: item.id,
|
||||
// page_no: page,
|
||||
// price: priceSort,
|
||||
// sales_sum: saleSort
|
||||
// }
|
||||
// const data = await loadingFun(getGoodsSearch, page, goodsList, status, params)
|
||||
// if (!data) return
|
||||
// this.page = data.page
|
||||
// this.goodsList = data.dataList
|
||||
// this.status = data.status
|
||||
let {
|
||||
page,
|
||||
goodsList,
|
||||
priceSort,
|
||||
saleSort,
|
||||
status,
|
||||
cateList,
|
||||
selectIndex
|
||||
} = this;
|
||||
const item = cateList[selectIndex]
|
||||
if(item.type == 0) return
|
||||
if (status == loadingType.FINISHED) return;
|
||||
const params = {
|
||||
category_id: item.id,
|
||||
page_no: page,
|
||||
price: priceSort,
|
||||
sales_sum: saleSort
|
||||
}
|
||||
const data = await loadingFun(getGoodsSearch, page, goodsList, status, params)
|
||||
console.log(data);
|
||||
|
||||
if (!data) return
|
||||
this.page = data.page
|
||||
this.goodsList = data.dataList
|
||||
this.status = data.status
|
||||
},
|
||||
|
||||
changeNumber() {
|
||||
@ -163,6 +197,15 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
buyNumber() {
|
||||
if (this.count > 0) {
|
||||
return this.count > 99 ? '99+' : this.count
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list: {
|
||||
handler(val) {
|
||||
@ -172,7 +215,6 @@
|
||||
this.selectIndex = index == -1 ? 0 : index
|
||||
this.cateName = val[this.selectIndex].name
|
||||
this.cateList = val
|
||||
this.cateTwoList = val[this.selectIndex] ? val[this.selectIndex].sons : []
|
||||
this.getGoodsSearchFun()
|
||||
}
|
||||
}
|
||||
@ -232,14 +274,14 @@
|
||||
position: relative;
|
||||
padding: 0 20rpx;
|
||||
.goods {
|
||||
padding-bottom: 200rpx;
|
||||
// padding-bottom: 200rpx;
|
||||
.info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,4 +295,12 @@
|
||||
background-color: #212526;
|
||||
}
|
||||
|
||||
.number {
|
||||
background-color: #FF2C3C;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user