|
- <template>
- <div class="app-container">
- <van-nav-bar
- title="我的供求"
- right-text="发布"
- left-arrow
- fixed
- placeholder
- @click-left="goClickLeft"
- @click-right="goAdd"
- />
- <van-tabs animated color="#007b76" type="card" style="margin-top: 10px;">
- <van-tab>
- <template #title><van-icon name="label" size="18" style="top: 4px"/>供应信息</template>
- <van-list
- v-model="loading"
- :finished="finished"
- finished-text="没有更多了"
- style="margin-top: 10px;"
- >
- <van-cell icon="play" v-for="(item , index) in supplyList" v-if="item.supplyDemandType == 1" :key="index">
- <template #title>
- <span :style="{color:item.isAuditStatus == 'Y' ? '#007E72':'#c21F3a'}">{{item.isAuditStatus == 'Y' ? '已审核':'未审核'}}</span> {{item.projectName}}
- </template>
- <template #label>
- 联系电话:{{item.phone}} <p style="float: right;">发布时间:{{item.logintime}}</p>
- <van-row style="margin-top: 5px;" v-if="item.isAuditStatus == 'N'">
- <van-col span="16"></van-col>
- <van-col span="4" style="color: #007E72;text-align: right;" @click="goAdd('update',item.id)" v-if="item.reply == null">
- <van-icon name="edit" size="15" style="top:3px"/>修改
- </van-col>
- <van-col span="4" style="color: #007E72;text-align: right;" @click="deleteSupply(item.id)" v-if="item.reply == null">
- <van-icon name="delete-o" size="15" style="top:3px"/>删除
- </van-col>
- </van-row>
- </template>
- </van-cell>
- </van-list>
- </van-tab>
- <van-tab title="选项">
- <template #title><van-icon name="bookmark" size="18" style="top: 4px"/>需求信息</template>
- <van-list
- v-model="loading"
- :finished="finished"
- finished-text="没有更多了"
- style="margin-top: 10px;"
- >
- <van-cell icon="play" v-for="(item , index) in supplyList" v-if="item.supplyDemandType == 2" :key="index">
- <template #title>
- <span :style="{color:item.isAuditStatus == 'Y' ? '#007E72':'#c21F3a'}">{{item.isAuditStatus == 'Y' ? '已审核':'未审核'}}</span> {{item.projectName}}
- </template>
- <template #label>
- 联系电话:{{item.phone}} <p style="float: right;">发布时间:{{item.logintime}}</p>
- <van-row style="margin-top: 5px;" v-if="item.isAuditStatus == 'N'">
- <van-col span="16"></van-col>
- <van-col span="4" style="color: #007E72;text-align: right;" @click="goAdd('update',item.id)" v-if="item.reply == null">
- <van-icon name="edit" size="15" style="top:3px"/>修改
- </van-col>
- <van-col span="4" style="color: #007E72;text-align: right;" @click="deleteSupply(item.id)" v-if="item.reply == null">
- <van-icon name="delete-o" size="15" style="top:3px"/>删除
- </van-col>
- </van-row>
- </template>
- </van-cell>
- </van-list>
- </van-tab>
- </van-tabs>
- </div>
- </template>
-
- <script>
- import { getMember , supplyList , deleteSupply} from "@/api/user/index";
- import { getInfo } from "@/api/login/index";
- import {Dialog} from "vant";
- export default {
- name: "userSupply",
- data() {
- return {
- //是否显示加载
- loading: false,
- //是否滚动到底部
- finished: false,
- //数据集合
- supplyList:[],
- //查询参数
- queryParams:{
- memberId:'',
- }
- };
- },
- created() {
- this.getInfo();
- },
- methods: {
- goAdd(type,id){
- console.log(id)
- if (id == undefined){
- window.location='supplyAdd';
- }else{
- window.location='supplyAdd?type='+type+'&id='+id;
- }
- },
- goClickLeft(){
- window.location='user';
- },
- getInfo(){
- getInfo().then(response => {
- getMember(response.user.userId).then(response => {
- this.queryParams.memberId = response.data.id;
- this.getList();
- });
- });
- },
- getList(){
- this.loading = true;
- supplyList(this.queryParams).then(response => {
- console.log(response)
- for (var i = 0; i < response.rows.length; i++) {
- this.supplyList.push(response.rows[i]);
- }
- this.finished = true;
- this.loading = false;
- });
- },
- deleteSupply(id){
- Dialog.confirm({
- title: '系统提示',
- message: '是否删除?',
- confirmButtonText: '确定',
- }).then(() => {
- deleteSupply(id).then(response => {
- Dialog.confirm({
- title: '系统提示',
- message: '删除成功',
- confirmButtonText: '确定',
- showCancelButton:false
- }).then(() => {
- this.supplyList = [];
- this.getList();
- })
- });
- })
- }
-
- },
- };
- </script>
|