|
@@ -7,8 +7,9 @@
|
|
|
<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
|
|
|
<view class="top">
|
|
|
<view class="title omit">{{ item.goodsName }}</view>
|
|
|
- <view class="icon"></view>
|
|
|
- <view class="clear"></view>
|
|
|
+ <view class="state" v-if="item.isRelease == 0" @click.stop="del(item)" style="color: #f44336">删除</view>
|
|
|
+ <view class="state" style="color: #4581fb" v-if="item.isRelease == 1">发布中</view>
|
|
|
+ <view class="state" style="color: #4CAF50" v-if="item.isOrders == 1">已接单</view>
|
|
|
</view>
|
|
|
<view class="con">
|
|
|
<view class="flex fs">
|
|
@@ -22,18 +23,14 @@
|
|
|
</view>
|
|
|
<view class="op">
|
|
|
<view class="flex">
|
|
|
- <view class="f rline">
|
|
|
- <text class="icon" style="color: #ff660d"></text>
|
|
|
- <text>编辑</text>
|
|
|
- </view>
|
|
|
- <view class="f">
|
|
|
- <text class="icon" style="color: #0081ff"></text>
|
|
|
- <text>发布</text>
|
|
|
- </view>
|
|
|
+ <view class="f rline" v-if="item.isRelease == 0" @click.stop="edit(item)">编辑</view>
|
|
|
+ <view class="f" v-if="item.isRelease == 0" style="color: #4581fb" @click.stop="op(item, 1)">发布</view>
|
|
|
+ <view class="f" v-if="item.isRelease == 1" style="color: #f44336" @click.stop="op(item, 0)">取消发布</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="clear"></view>
|
|
|
</view>
|
|
|
+ <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
|
|
|
+ <u-empty v-if="!loadMore && list.length == 0"></u-empty>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -42,11 +39,12 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- tab: [//isRelease:是否发布[0=待发布,1=已发布] isOrders:是否被接单[0=待接单,1=已被接单]
|
|
|
- { name: '全部', isRelease: '' ,isOrders: ''},
|
|
|
- { name: '待发布', isRelease: 0 ,isOrders: 0},
|
|
|
- { name: '发布中', isRelease: 1 ,isOrders: 0},
|
|
|
- { name: '已接单', isRelease: 1 ,isOrders: 1},
|
|
|
+ tab: [
|
|
|
+ //isRelease:是否发布[0=待发布,1=已发布] isOrders:是否被接单[0=待接单,1=已被接单]
|
|
|
+ { name: '全部', isRelease: '', isOrders: '' },
|
|
|
+ { name: '待发布', isRelease: 0, isOrders: 0 },
|
|
|
+ { name: '发布中', isRelease: 1, isOrders: 0 },
|
|
|
+ { name: '已接单', isRelease: 1, isOrders: 1 }
|
|
|
//{ name: '已确认', isRelease: 1 ,isOrders: 1},
|
|
|
//{ name: '已完成', isRelease: 1 ,isOrders: 1}
|
|
|
],
|
|
@@ -57,6 +55,9 @@ export default {
|
|
|
},
|
|
|
onLoad(e) {
|
|
|
this.getData();
|
|
|
+ uni.$on('purchaser_buy_list', res => {
|
|
|
+ this.refresh();
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
getData() {
|
|
@@ -79,6 +80,45 @@ export default {
|
|
|
detail(item) {
|
|
|
uni.navigateTo({ url: '/pages/market/two/purchaser/buy/detail?id=' + item.id });
|
|
|
},
|
|
|
+ edit(item) {
|
|
|
+ uni.navigateTo({ url: '/pages/market/two/purchaser/buy/add?id=' + item.id });
|
|
|
+ },
|
|
|
+ op(item, isRelease) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: isRelease == 0 ? '确定取消发布' : '确定发布到市场?',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.http.request({
|
|
|
+ url: '/level-two-server/app/TbGoodsDemand/changeState',
|
|
|
+ method: 'POST',
|
|
|
+ data: { id: item.id, isRelease: isRelease },
|
|
|
+ success: res => {
|
|
|
+ uni.showToast({ title: '操作成功' });
|
|
|
+ item.isRelease = isRelease;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ del(item) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定删除该需求?',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.http.request({
|
|
|
+ url: '/level-two-server/app/TbGoodsDemand/delete?id=' + item.id,
|
|
|
+ success: res => {
|
|
|
+ uni.showToast({ title: '删除成功' });
|
|
|
+ this.list.splice(this.list.indexOf(item), 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//刷新数据
|
|
|
refresh() {
|
|
|
this.loadMore = true;
|