From d1bb68d9f9054bbf87cd84956d3240c71d8e370c Mon Sep 17 00:00:00 2001
From: xuxy <1059738716@qq.com>
Date: 星期二, 25 六月 2024 16:55:44 +0800
Subject: [PATCH] update 商品管理和花农的
---
pages/farmer/flower-manage/flower-manage.vue | 143 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 108 insertions(+), 35 deletions(-)
diff --git a/pages/farmer/flower-manage/flower-manage.vue b/pages/farmer/flower-manage/flower-manage.vue
index 3b6f2db..2e1e6f1 100644
--- a/pages/farmer/flower-manage/flower-manage.vue
+++ b/pages/farmer/flower-manage/flower-manage.vue
@@ -4,7 +4,7 @@
<view @click.stop="clickButton('add')" class="button button-add"></view>
<view @click.stop="clickButton('in')" class="button button-search-in"></view>
<view @click.stop="clickButton('unpass')" class="button button-search-unpass"></view>
- <view @click.stop="clickButton('inpass')" class="button button-search-inpass"></view>
+ <view @click.stop="clickButton('inpass')" class="button button-search-inpass" style="flex:5"></view>
<view @click.stop="clickButton('delete')" class="button button-search-delete"></view>
</view>
@@ -14,38 +14,43 @@
<view v-for="(item,index) in list" :key="index" class="m-b-24 flow-manage-list">
<view class="flow-manage-list-item">
<view class="flex">
- <image class="flower-img img100 m-r-6" :src="item.img" @click="previewImg(item.img)"></image>
- <view>
- <view class="flex">
- <view class="title">{{item.title}}<span class="level">A级别</span></view>
- <view class="t-red m-l-a m-r-0">
- ¥20.00/扎
+ <image class="flower-img img100 m-r-6" :src="item.cover" @click="previewImg(item.cover)">
+ </image>
+ <view class="flex1">
+ <view class=" flex">
+ <view class="title">{{item.name}}<span class="level">{{item.levelStr}}</span></view>
+ <view class="m-l-a m-r-0">
+ {{item.categoryStr || '-'}}
</view>
</view>
- <view class="each-list">
+ <view class="each-list m-t-12">
<view class="each-item">
- <view class="label">分类</view>
- <view class="value">卡罗拉</view>
+ <view class="label">状态</view>
+ <view class="value">{{item.statusStr || '-'}}</view>
</view>
<view class="each-item">
<view class="label">颜色</view>
- <view class="value">红色</view>
+ <view class="value">{{item.color || '-'}}</view>
</view>
<view class="each-item">
<view class="label">规格</view>
- <view class="value">20支/扎</view>
+ <view class="value">{{item.unit || '-'}}</view>
</view>
<view class="each-item">
<view class="label">库存</view>
- <view class="value">10</view>
+ <view class="value">{{item.stock || 0}}</view>
</view>
<view class="each-item">
<view class="label">销量</view>
- <view class="value">10</view>
+ <view class="value">{{item.sales || 0}}</view>
+ </view>
+ <view class="each-item">
+ <view class="label">价格</view>
+ <view class="value">{{item.price||'-'}}</view>
</view>
</view>
</view>
@@ -54,13 +59,16 @@
</view>
<view class="buttons">
- <view class="button" @click.stop="toDetailAdd(item)">复制</view>
- <view class="button" @click.stop="buttonDelete(item)">删除</view>
+ <view class="button" @click.stop="toDetail(item)">编辑</view>
+
<view class="button" @click.stop="buttonStatus(item,'off')" v-if="item.status=='UP'">下架</view>
<view class="button" @click.stop="buttonStatus(item,'up')" v-if="item.status=='OFF'">上架</view>
- <view class="button" @click.stop="toDetail(item)">编辑</view>
- <view class="button" @click.stop="changeValue(item,'price')">价格</view>
- <view class="button" @click.stop="changeValue(item,'stock')">库存</view>
+ <view class="button" @click.stop="openValue(item,'price')">价格</view>
+ <view class="button" @click.stop="openValue(item,'stock')">库存</view>
+ <view class="button" @click.stop="toDetailAdd(item)">复制</view>
+
+ <view class="button t-red" @click.stop="buttonDelete(item)">删除</view>
+
</view>
</view>
</view>
@@ -68,6 +76,18 @@
<!-- 判断是否到底了,自动吧 -->
<footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg>
+
+ <uni-popup ref="popup_input" type="bottom">
+ <view class="component-popup_input">
+
+ <!-- 输入框-->
+ <uni-easyinput class="p9-12" maxlength="100" type="textarea" v-model="content"
+ :placeholder="inputplaceholder"></uni-easyinput>
+
+ <!-- 提交按钮 -->
+ <view class="button-green" @click="submitValue">提交</view>
+ </view>
+ </uni-popup>
</view>
</template>
@@ -78,7 +98,11 @@
type: 'all',
query: {
type: ''
- }
+ },
+ content: '',
+ currentInputDto: {},
+ currentInputKey: '',
+ inputplaceholder:'',
}
},
onLoad(options) {
@@ -112,21 +136,31 @@
uni.stopPullDownRefresh()
},
methods: {
- async changeValue(item, key) {
+ async openValue(item, key) {
+ this.content = item[key] || ''
+ this.currentInputDto = item
+ this.currentInputKey = key
+ this.inputplaceholder = key=='price'&&'请输入价格(元)' || key=='stock'&&'请输入库存(整数)' || '请输入'
+ this.$refs.popup_input.open('top')
+ },
+ async submitValue() {
+ let item = this.currentInputDto,
+ key = this.currentInputKey
const res = await this.$message.confirm(`确定修改此商品的${key==='price'&&'价格'|| key==='stock'&&'库存'}吗`, {
- editable: true
+ editable: false
})
- if(!res.content){
+
+ if (!this.content) {
this.$message.showToast('输入不能为空')
return
}
var value = ''
- if(key=='price'){
- value = parseFloat(res.content).toFixed(2)
- }else{
- value = parseInt(res.content)
+ if (key == 'price') {
+ value = parseFloat(this.content).toFixed(2)
+ } else {
+ value = parseInt(this.content)
}
- if(isNaN(value)){
+ if (isNaN(value)) {
this.$message.showToast('输入格式不正确')
return
}
@@ -143,6 +177,8 @@
if (res.code == 0) {
this.$message.showToast('操作成功')
item[key] = value
+ this.$refs.popup_input.close()
+
}
}).finally(() => {
this.$message.hideLoading()
@@ -210,11 +246,28 @@
<style lang="scss" scoped>
.flow-manage {
.flow-manage-list {
- margin: 20rpx 30rpx;
+ // padding: 20rpx 30rpx;
padding: 22rpx;
+ background-color: #fff;
- .flow-manage-item {
+ .flow-manage-list-item {
+
margin-bottom: 20rpx;
+
+ .title {
+ font-weight: 600;
+ font-size: 28rpx;
+ color: #000000;
+ line-height: 40rpx;
+
+ .level {
+ font-weight: 400;
+ font-size: 28rpx;
+ color: #20613D;
+ line-height: 40rpx;
+ margin-left: 20rpx;
+ }
+ }
.buttons {
display: flex;
@@ -222,16 +275,18 @@
.button {
margin: 0 auto;
width: 98rpx;
- height: 48rpx;
+ line-height: 48rpx;
border-radius: 24rpx;
border: 2rpx solid #CECECE;
+ text-align: center;
}
}
.flower-img {
width: 128rpx;
height: 118rpx;
-
+ min-width: 128rpx;
+ min-height: 118rpx;
}
.each-list {
@@ -242,11 +297,16 @@
min-width: 30%;
max-width: 40%;
text-align: center;
+ margin-left: 0rpx;
+ margin-right: auto;
+ display: flex;
.label {
font-weight: 400;
font-size: 24rpx;
color: #666666;
+ text-align: left;
+ padding-right: 10rpx;
}
.label::after {
@@ -261,16 +321,29 @@
.top-buttons {
display: flex;
- margin: 22rpx 42rpx;
+ padding: 22rpx 42rpx;
+ background-color: #fff;
.button {
// flex:1;
margin: 0 auto;
- width: 96rpx;
- height: 130rpx;
+ width: 90rpx;
+ height: 146rpx;
background-size: 100% 100%;
+ text-align: center;
+ // min-width: 90rpx;
+ flex: 4;
+ // max-width: 90rpx;
+ margin-left:14rpx;
+ margin-right:14rpx;
}
+ .button:first-child {
+ margin-left: 0rpx
+ }
+ .button:last-child {
+ margin-right: 0rpx
+ }
.button-add {
background-image: url('@/static/images/farmer/flower/flower-mange-icon-add-flower.png');
--
Gitblit v1.9.3