移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

148 rivejä
5.0 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. title="我的供求"
  5. right-text="发布"
  6. left-arrow
  7. fixed
  8. placeholder
  9. @click-left="goClickLeft"
  10. @click-right="goAdd"
  11. />
  12. <van-tabs animated color="#007b76" type="card" style="margin-top: 10px;">
  13. <van-tab>
  14. <template #title><van-icon name="label" size="18" style="top: 4px"/>供应信息</template>
  15. <van-list
  16. v-model="loading"
  17. :finished="finished"
  18. finished-text="没有更多了"
  19. style="margin-top: 10px;"
  20. >
  21. <van-cell icon="play" v-for="(item , index) in supplyList" v-if="item.supplyDemandType == 1" :key="index">
  22. <template #title>
  23. <span :style="{color:item.isAuditStatus == 'Y' ? '#007E72':'#c21F3a'}">{{item.isAuditStatus == 'Y' ? '已审核':'未审核'}}</span> {{item.projectName}}
  24. </template>
  25. <template #label>
  26. 联系电话:{{item.phone}} <p style="float: right;">发布时间:{{item.logintime}}</p>
  27. <van-row style="margin-top: 5px;" v-if="item.isAuditStatus == 'N'">
  28. <van-col span="16"></van-col>
  29. <van-col span="4" style="color: #007E72;text-align: right;" @click="goAdd('update',item.id)" v-if="item.reply == null">
  30. <van-icon name="edit" size="15" style="top:3px"/>修改
  31. </van-col>
  32. <van-col span="4" style="color: #007E72;text-align: right;" @click="deleteSupply(item.id)" v-if="item.reply == null">
  33. <van-icon name="delete-o" size="15" style="top:3px"/>删除
  34. </van-col>
  35. </van-row>
  36. </template>
  37. </van-cell>
  38. </van-list>
  39. </van-tab>
  40. <van-tab title="选项">
  41. <template #title><van-icon name="bookmark" size="18" style="top: 4px"/>需求信息</template>
  42. <van-list
  43. v-model="loading"
  44. :finished="finished"
  45. finished-text="没有更多了"
  46. style="margin-top: 10px;"
  47. >
  48. <van-cell icon="play" v-for="(item , index) in supplyList" v-if="item.supplyDemandType == 2" :key="index">
  49. <template #title>
  50. <span :style="{color:item.isAuditStatus == 'Y' ? '#007E72':'#c21F3a'}">{{item.isAuditStatus == 'Y' ? '已审核':'未审核'}}</span> {{item.projectName}}
  51. </template>
  52. <template #label>
  53. 联系电话:{{item.phone}} <p style="float: right;">发布时间:{{item.logintime}}</p>
  54. <van-row style="margin-top: 5px;" v-if="item.isAuditStatus == 'N'">
  55. <van-col span="16"></van-col>
  56. <van-col span="4" style="color: #007E72;text-align: right;" @click="goAdd('update',item.id)" v-if="item.reply == null">
  57. <van-icon name="edit" size="15" style="top:3px"/>修改
  58. </van-col>
  59. <van-col span="4" style="color: #007E72;text-align: right;" @click="deleteSupply(item.id)" v-if="item.reply == null">
  60. <van-icon name="delete-o" size="15" style="top:3px"/>删除
  61. </van-col>
  62. </van-row>
  63. </template>
  64. </van-cell>
  65. </van-list>
  66. </van-tab>
  67. </van-tabs>
  68. </div>
  69. </template>
  70. <script>
  71. import { getMember , supplyList , deleteSupply} from "@/api/user/index";
  72. import { getInfo } from "@/api/login/index";
  73. import {Dialog} from "vant";
  74. export default {
  75. name: "userSupply",
  76. data() {
  77. return {
  78. //是否显示加载
  79. loading: false,
  80. //是否滚动到底部
  81. finished: false,
  82. //数据集合
  83. supplyList:[],
  84. //查询参数
  85. queryParams:{
  86. memberId:'',
  87. }
  88. };
  89. },
  90. created() {
  91. this.getInfo();
  92. },
  93. methods: {
  94. goAdd(type,id){
  95. console.log(id)
  96. if (id == undefined){
  97. window.location='supplyAdd';
  98. }else{
  99. window.location='supplyAdd?type='+type+'&id='+id;
  100. }
  101. },
  102. goClickLeft(){
  103. window.location='user';
  104. },
  105. getInfo(){
  106. getInfo().then(response => {
  107. getMember(response.user.userId).then(response => {
  108. this.queryParams.memberId = response.data.id;
  109. this.getList();
  110. });
  111. });
  112. },
  113. getList(){
  114. this.loading = true;
  115. supplyList(this.queryParams).then(response => {
  116. console.log(response)
  117. for (var i = 0; i < response.rows.length; i++) {
  118. this.supplyList.push(response.rows[i]);
  119. }
  120. this.finished = true;
  121. this.loading = false;
  122. });
  123. },
  124. deleteSupply(id){
  125. Dialog.confirm({
  126. title: '系统提示',
  127. message: '是否删除?',
  128. confirmButtonText: '确定',
  129. }).then(() => {
  130. deleteSupply(id).then(response => {
  131. Dialog.confirm({
  132. title: '系统提示',
  133. message: '删除成功',
  134. confirmButtonText: '确定',
  135. showCancelButton:false
  136. }).then(() => {
  137. this.supplyList = [];
  138. this.getList();
  139. })
  140. });
  141. })
  142. }
  143. },
  144. };
  145. </script>