第一次上传
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 新增商品按钮 -->
|
||||
<view class="add-product-btn">
|
||||
<up-button @click="Service.GoPage('/pages/goods/addGoods')" color="var(--nav-mian)"
|
||||
:customStyle="{'border-radius':'15rpx'}"> + 新增商品 </up-button>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="product-list">
|
||||
<view class="product-item" v-for="(product, index) in products" :key="index">
|
||||
<view class="product-info">
|
||||
<image :src="Service.GetMateUrlByImg(product.img)" mode="aspectFill" class="product-image"></image>
|
||||
<view class="product-details">
|
||||
<view class="product-header">
|
||||
<text class="product-name">{{ product.name }}</text>
|
||||
|
||||
</view>
|
||||
<text class="product-price">¥{{ product.price }}</text>
|
||||
|
||||
</view>
|
||||
<view class="tag" :style="{ 'background-color':product.status==0?'#D9D9D9':'#52C41A', } "
|
||||
style="padding: 7rpx 24rpx;border-radius: 31rpx;font-size: 24rpx; color: #fff; height: fit-content; ">
|
||||
{{ product.status==0?'已下架':'已上架' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="product-actions">
|
||||
<text class="action-btn edit-btn" @click="editProduct(product)">编辑</text>
|
||||
<text class="action-btn" :class="product.status === 0 ? '上架' : '下架'" @click="toggleStatus(product)">
|
||||
{{ product.status === 0? '上架' : '下架' }}
|
||||
</text>
|
||||
<text class="action-btn delete-btn" @click="deleteProduct(product)">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { Service } from '@/Service/Service'
|
||||
import { vpMerchService } from '@/Service/vp/vpMerchService'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
// import { vpCommunityService } from '@/Service/vp/vpCommunityService'
|
||||
|
||||
|
||||
// 商品数据类型定义
|
||||
interface Product {
|
||||
goodsId : string
|
||||
name : string
|
||||
price : number
|
||||
status : number
|
||||
img : string
|
||||
brief : string
|
||||
}
|
||||
|
||||
// 模拟商品数据
|
||||
const products = ref<Product[]>([
|
||||
{
|
||||
goodsId: '',
|
||||
name: '',
|
||||
price: null,
|
||||
status: null,
|
||||
img: '',
|
||||
brief: ''
|
||||
}
|
||||
])
|
||||
|
||||
let status = ref('nomore')
|
||||
let page = ref(1)
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getData()
|
||||
})
|
||||
|
||||
const getData = () => {
|
||||
products.value = []
|
||||
status.value = 'loadmore'
|
||||
page.value = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
const getList = () => {
|
||||
if (status.value !== 'loadmore') {
|
||||
return
|
||||
}
|
||||
status.value = 'loading'
|
||||
vpMerchService.GetMerchGoods(page.value).then(res => {
|
||||
products.value = [...products.value, ...res.data.list]
|
||||
status.value = res.data.list.length == 10 ? 'loadmore' : 'nomore'
|
||||
page.value++
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 编辑商品
|
||||
const editProduct = (product : Product) => {
|
||||
Service.GoPage('/pages/goods/addGoods?goodsId=' + product.goodsId)
|
||||
}
|
||||
|
||||
// 切换商品状态(上架/下架)
|
||||
const toggleStatus = (product : Product) => {
|
||||
vpMerchService.UpdateGoodsStatus(product.goodsId).then(res => {
|
||||
if (res.code == 0) {
|
||||
Service.Msg('修改成功!')
|
||||
getData()
|
||||
}else{
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品
|
||||
const deleteProduct = (product : Product) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除该商品么?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
vpMerchService.DelGoods(product.goodsId).then(res=>{
|
||||
if (res.code == 0) {
|
||||
Service.Msg('删除成功!')
|
||||
getData()
|
||||
}else{
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 用户点击取消后的操作
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 新增商品按钮 */
|
||||
.add-product-btn {
|
||||
padding: 30rpx;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 商品列表 */
|
||||
.product-list {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.product-item {
|
||||
background-color: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
display: flex;
|
||||
// align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 155rpx;
|
||||
height: 155rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.product-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.product-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 36rpx;
|
||||
color: #ff6600;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.product-sales {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* 操作按钮 */
|
||||
.product-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.online-btn {
|
||||
color: #4cd964;
|
||||
}
|
||||
|
||||
.offline-btn {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
color: #ff3b30;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,389 @@
|
||||
{
|
||||
"easycom": {
|
||||
// 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175
|
||||
"custom": {
|
||||
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
|
||||
{
|
||||
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationBarBackgroundColor": "#36394D",
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/community",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/user",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/index/shop",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "积分商城"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/index/order",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "我的订单"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "v派商家",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"subPackages": [{
|
||||
"root": "pages/community",
|
||||
"pages": [{
|
||||
"path": "noticeList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "merchantCom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区商家"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "merchantDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "美食小店",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/goods",
|
||||
"pages": [
|
||||
{
|
||||
"path": "integralGoods",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "merchant",
|
||||
"style": {
|
||||
"navigationBarTitleText": "热门商家"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "goodsDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "商品详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "goodsContro",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "商品管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addGoods",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "添加商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "Pay",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "付款"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goodsPay",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分订单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "search",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "搜索",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "goodsClass",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "分类",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "orderDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "订单详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "storeOrderInfo",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "订单详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/article",
|
||||
"pages": [{
|
||||
"path": "articleCom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "newsList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新闻公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "news",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新闻详情"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}, {
|
||||
"root": "pages/userFunc",
|
||||
"pages": [{
|
||||
"path" : "setData",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "编辑资料"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "integration",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "积分明细",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "trade",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "交易记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "editStore",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "编辑店铺"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "set",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "设置",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "bind",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "绑定手机号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "password",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "修改支付密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "storeInter",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "余额明细",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "withdrow",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "提现"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "vip",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "会员码",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "promoteCode",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "推广码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addressList",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "收货地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addAddress",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "添加地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "alliance-card",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的联盟卡",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "member-benefits",
|
||||
"style": {
|
||||
"navigationBarTitleText": "会员权益",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "promotion",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的推广",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "invite",
|
||||
"style": {
|
||||
"navigationBarTitleText": "邀请好友",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "feedback",
|
||||
"style": {
|
||||
"navigationBarTitleText": "意见反馈",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "about-us",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于我们",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "coupon",
|
||||
"style": {
|
||||
"navigationBarTitleText": "优惠券",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "favorites",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的收藏",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "finish",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "提现"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
"tabBar": {
|
||||
"color": "#8a8a8a",
|
||||
"selectedColor": "#EC754B",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [{
|
||||
"text": "首页",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "/static/tabBar/home.png",
|
||||
"selectedIconPath": "/static/tabBar/homed.png"
|
||||
},
|
||||
// {
|
||||
// "text": "社区",
|
||||
// "pagePath": "pages/index/community",
|
||||
// "iconPath": "/static/tabBar/community.png",
|
||||
// "selectedIconPath": "/static/tabBar/communityed.png"
|
||||
// }
|
||||
// ,
|
||||
// {
|
||||
// "text": "积分商城",
|
||||
// "pagePath": "pages/index/shop",
|
||||
// "iconPath": "/static/tabBar/shop.png",
|
||||
// "selectedIconPath": "/static/tabBar/shoped.png"
|
||||
// },
|
||||
{
|
||||
"text": "我的订单",
|
||||
"pagePath": "pages/index/order",
|
||||
"iconPath": "/static/tabBar/shop.png",
|
||||
"selectedIconPath": "/static/tabBar/shoped.png"
|
||||
},
|
||||
{
|
||||
"text": "个人中心",
|
||||
"pagePath": "pages/index/user",
|
||||
"iconPath": "/static/tabBar/user.png",
|
||||
"selectedIconPath": "/static/tabBar/usered.png"
|
||||
}]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="30px" height="30px" viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#FFFFFF;stroke-width:2.4306;stroke-miterlimit:10;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
</style>
|
||||
<g>
|
||||
<path class="st0" d="M17.1,24.2h-12c-0.2,0-0.3-0.2-0.3-0.3v-9.3c0-0.2,0.2-0.3,0.3-0.3h12c0.2,0,0.3,0.2,0.3,0.3v9.3
|
||||
C17.5,24.1,17.3,24.2,17.1,24.2z"/>
|
||||
<path class="st0" d="M16.6,5.4c4.8,0,8.7,3.9,8.7,8.7"/>
|
||||
<polyline class="st0" points="19.3,10.1 14.9,5.6 19.3,1.2 "/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 791 B |
Reference in New Issue
Block a user