jiuyiUniapp/jiuyi2/pages/shop/store/commodities.vue

137 lines
2.9 KiB
Vue
Raw Normal View History

2024-12-27 15:03:48 +08:00
<script setup>
// 商品管理
import {
2025-01-16 20:18:22 +08:00
ref,
reactive,
2024-12-27 15:03:48 +08:00
} from 'vue'
import {
onLoad,
onReachBottom
} from "@dcloudio/uni-app"
2025-01-16 20:18:22 +08:00
// 顶部导航
2024-12-27 15:03:48 +08:00
import apex from "@/components/header/apex.vue"
2025-01-16 20:18:22 +08:00
// api
import api from '@/api/index.js'
// 工具库
import util from '@/common/js/util.js'
// 产品列表
const product = reactive({
list: [],
pageNum: 1,
pageSize: 10,
})
onLoad(() => {
// 获取列表
getList()
})
// 获取更多商品
function refeshList() {
if (product.list.length >= product.total) return
product.pageNum++
getList()
}
// 获取更多商品
function getMoreList() {
if (product.list.length >= product.total) return
product.pageNum++
getList()
}
// 请求列表
function getList() {
//
api.shop.getProductionListByUserId({
data: {
pageSize: product.pageSize,
pageNum: product.pageNum,
}
}).then(rs => {
if (rs.code === 200) {
if (product.pageNum == 1) product.list.length = 0
product.list.push(...rs.rows)
product.total = rs.total
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 编辑
* @param {Object} item
*/
function handleEdit(item) {
uni.navigateTo({
url: util.setUrl('/pages/release/commodity',{
id: item.id
})
})
}
2025-02-04 20:44:28 +08:00
/**
* 跳转
* @param {Object} url 路径
*/
function link(url) {
uni.navigateTo({
url
})
}
2024-12-27 15:03:48 +08:00
</script>
<template>
<view class="app">
<apex title="商品管理">
<template #right>
2025-02-04 20:44:28 +08:00
<view class="f24" @click="link('/pages/release/commodity')">添加</view>
2024-12-27 15:03:48 +08:00
</template>
</apex>
<view class="listBox oh">
2025-01-16 20:18:22 +08:00
<view class="item oh mtb20 mlr20 plr20 bfff br20" v-for="(item,index) in product.list" :key="index">
2024-12-27 15:03:48 +08:00
<!-- 商品信息 -->
<view class="product line df ptb20">
<view class="poster wh160">
2025-01-16 20:18:22 +08:00
<image class="wh160 br10" :src="item.sliderImage.split(',')[0]"
2024-12-27 15:03:48 +08:00
mode="aspectFill" />
</view>
<view class="info df fdc jcsb f1 ml20">
2025-01-16 20:18:22 +08:00
<view class="name t2hd c333 f28">{{item.name}}</view>
2024-12-27 15:03:48 +08:00
2025-01-16 20:18:22 +08:00
<view class="count fs0 c999 f24">销量{{item.sales}}</view>
2024-12-27 15:03:48 +08:00
<view class="other df aic">
<view class="price f1 cFF9B27">
<text class="f30">价格</text>
<text class="f20"></text>
2025-01-16 20:18:22 +08:00
<text class="f30">{{item.price}}</text>
2024-12-27 15:03:48 +08:00
</view>
2025-01-16 20:18:22 +08:00
<!-- <view class="f1 c999 f24">库存×1</view> -->
2024-12-27 15:03:48 +08:00
</view>
</view>
</view>
<view class="menu ptb20 df jcr">
<!-- <view class="btn sm bar closeHollow plr30">上架</view> -->
<view class="btn sm bar closeHollow plr30">下架</view>
<view class="btn sm bar closeHollow plr30">改价</view>
<!-- 在没有进行中的订单才能删除 -->
<!-- <view class="btn sm bar closeHollow plr30">删除</view> -->
2025-01-16 20:18:22 +08:00
<view class="btn sm bar warmHollow plr30" @click="handleEdit(item)">编辑</view>
2024-12-27 15:03:48 +08:00
</view>
</view>
</view>
</view>
</template>
2025-01-16 20:18:22 +08:00
<style lang="scss" scoped>
2024-12-27 15:03:48 +08:00
//
</style>