| | |
| | | <view class="flow-manage"> |
| | | <view class="top-buttons" v-if="type==='all'"> |
| | | <view @click.stop="clickButton('add')" class="button button-add"></view> |
| | | <view class="button button-search-in"></view> |
| | | <view class="button button-search-unpass"></view> |
| | | <view class="button button-search-inpass"></view> |
| | | <view class="button button-search-delete"></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('delete')" class="button button-search-delete"></view> |
| | | |
| | | </view> |
| | | |
| | |
| | | |
| | | </view> |
| | | <view class="buttons"> |
| | | <view class="button">复制</view> |
| | | <view class="button">删除</view> |
| | | <view class="button">下架</view> |
| | | <view class="button" @click.stop="toDetailAdd(item)">复制</view> |
| | | <view class="button" @click.stop="buttonDelete(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">价格</view> |
| | | <view class="button">库存</view> |
| | | <view class="button" @click.stop="changeValue(item,'price')">价格</view> |
| | | <view class="button" @click.stop="changeValue(item,'stock')">库存</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | onLoad(options) { |
| | | this.type = options.type || 'all' |
| | | //todo 根据type切换查询条件 |
| | | this.listApi = '/api/ua/announcement/list' |
| | | if (this.type === 'delete') { |
| | | this.listApi = '/api/supplier/flower/list/rc' |
| | | |
| | | } else { |
| | | this.listApi = '/api/supplier/flower/list' |
| | | this.query.status = '' |
| | | if (this.type === 'inpass') { |
| | | this.query.status = 'PENDING' |
| | | } |
| | | if (this.type === 'in') { |
| | | this.query.status = 'UP' |
| | | } |
| | | if (this.type === 'unpass') { |
| | | this.query.status = 'REJECT' |
| | | } |
| | | } |
| | | this.getList() |
| | | }, |
| | | onReachBottom() { |
| | |
| | | uni.stopPullDownRefresh() |
| | | }, |
| | | methods: { |
| | | async changeValue(item, key) { |
| | | const res = await this.$message.confirm(`确定修改此商品的${key==='price'&&'价格'|| key==='stock'&&'库存'}吗`, { |
| | | editable: true |
| | | }) |
| | | if(!res.content){ |
| | | this.$message.showToast('输入不能为空') |
| | | return |
| | | } |
| | | var value = '' |
| | | if(key=='price'){ |
| | | value = parseFloat(res.content).toFixed(2) |
| | | }else{ |
| | | value = parseInt(res.content) |
| | | } |
| | | if(isNaN(value)){ |
| | | this.$message.showToast('输入格式不正确') |
| | | return |
| | | } |
| | | var dto = { |
| | | id: item.id, |
| | | } |
| | | dto[key] = value |
| | | |
| | | |
| | | this.$message.showLoading() |
| | | this.$http.request('post', '/api/supplier/flower/list/' + key, { |
| | | data: dto |
| | | }).then(res => { |
| | | if (res.code == 0) { |
| | | this.$message.showToast('操作成功') |
| | | item[key] = value |
| | | } |
| | | }).finally(() => { |
| | | this.$message.hideLoading() |
| | | }) |
| | | }, |
| | | async buttonStatus(item, status) { |
| | | await this.$message.confirm(`确定${status==='off'?'下降':'上架'}此商品吗`) |
| | | this.$message.showLoading() |
| | | this.$http.request('get', '/api/supplier/flower/list/' + status, { |
| | | params: { |
| | | id: item.id |
| | | } |
| | | }).then(res => { |
| | | if (res.code == 0) { |
| | | this.$message.showToast('操作成功') |
| | | item.status = status |
| | | item.statusStr = (status == 'off' ? '下架' : '上架') |
| | | } |
| | | }).finally(() => { |
| | | this.$message.hideLoading() |
| | | }) |
| | | }, |
| | | async buttonDelete(item) { |
| | | await this.$message.confirm('确定删除此商品吗') |
| | | this.$message.showLoading() |
| | | this.$http.request('get', '/api/supplier/flower/list/delete', { |
| | | params: { |
| | | id: item.id |
| | | } |
| | | }).then(res => { |
| | | if (res.code == 0) { |
| | | this.$message.showToast('删除成功') |
| | | this.refreshList() |
| | | } |
| | | }).finally(() => { |
| | | this.$message.hideLoading() |
| | | }) |
| | | }, |
| | | toDetail(item) { |
| | | uni.navigateTo({ |
| | | url: '/pages/farmer/flower-manage/flower-add?id=' + item.id |
| | | }) |
| | | }, |
| | | toDetailAdd(item) { |
| | | uni.navigateTo({ |
| | | url: '/pages/farmer/flower-manage/flower-add?copyId=' + item.id |
| | | }) |
| | | }, |
| | | clickButton(type) { |
| | | if (type == 'add') { |
| | | //添加页面 |