release.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="center">
  3. <view class="introduce-section">
  4. <view class="informations" v-for="(item , index) in procurementPlanInfos" :Key="index">
  5. <view @click="details(item)">
  6. <view class="labels">{{item.goodsName}}</view>
  7. <view class="labels">{{item.weight}}</view>
  8. <view class="labels">{{item.unitPrice}}</view>
  9. <view class="title">{{item.receivePrivate}}{{item.receiveCity}}{{item.receiveArea}}</view>
  10. </view>
  11. <view @click='edit(item)' v-if='item.status!="待审核"' class='cu-tag radius line-pink'>编辑</view>
  12. <view class='cu-tag radius line-pink' @click="switch1(item)">隐藏</view>
  13. <view class='cu-tag radius line-pink' @click="switch1(item)">显示</view>
  14. <view class='cu-tag radius line-pink' @click="deleteRelease(item)">删除</view>
  15. <view v-if='item.status=="已驳回"' class='cu-tag radius line-pink put'>未通过</view>
  16. <view v-if='item.status=="待审核"' class='cu-tag radius line-pink put'>审核中</view>
  17. <view v-if='item.status=="已认证"' class='cu-tag radius line-pink put'>已通过</view>
  18. </view>
  19. </view>
  20. <view class="page-bottom">
  21. <view class="action-btn-group">
  22. <picker style='display:inline-block;' @change="releaseChange" :value="releases" :range="releaseType">
  23. <button type="primary" class=" action-btn no-border add-cart-btn" >发布</button>
  24. <view class="picker">
  25. {{releases>-1?releaseType[releases]:''}}
  26. </view>
  27. </picker>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. releaseType:["我要卖粮","我要买粮"],
  37. release:'',
  38. releases:'',
  39. receivePrivate:'',
  40. procurementPlanInfo:{
  41. pageSize:10,
  42. currentPage:1
  43. },
  44. releaseIndex:"",
  45. pageSize:10,
  46. currentPage:1,
  47. procurementPlanInfos:[],
  48. }
  49. },
  50. onLoad(){
  51. console.log("release.vue onload")
  52. this.getList()
  53. },
  54. methods: {
  55. switch1(item){
  56. console.log(125489)
  57. // if (!this.hasLogin) {
  58. uni.showModal({
  59. // title: '登录提示',
  60. content: '隐藏后该信息不再展示给其他用户,是否确定隐藏?',
  61. showCancel: true,
  62. confirmText: '确定',
  63. success: (e) => {
  64. this.$api.doRequest('post','/procurementPlanInfo/api/editStatus',{id:item.id,flag:0}).then(res => {
  65. this.procurementPlanInfos = res.data.data.records
  66. if (res.errmsg == "Success") {
  67. this.$api.msg('隐藏成功!')
  68. return
  69. }
  70. })
  71. .catch(res => {
  72. uni.showToast({
  73. title: res.errmsg,
  74. icon:'none',
  75. duration: 2000
  76. })
  77. });
  78. },
  79. fail: () => {},
  80. complete: () => {}
  81. })
  82. // }
  83. },
  84. edit(item){
  85. uni.navigateTo({
  86. url: `/pageD/myRelease/buyEdit?id=${item.id}`
  87. })
  88. },
  89. deleteRelease(item){
  90. // if (!this.hasLogin) {
  91. uni.showModal({
  92. // title: '登录提示',
  93. content: '确定删除该信息?',
  94. showCancel: true,
  95. confirmText: '确定',
  96. success: (e) => {
  97. this.$api.doRequest('post','/procurementPlanInfo/api/deleteProcurementPlan',{id:item.id}).then(res => {
  98. this.procurementPlanInfos = res.data.data.records
  99. if (res.errmsg == "Success") {
  100. this.$api.msg('删除成功!')
  101. this.getList()
  102. return
  103. }
  104. })
  105. .catch(res => {
  106. uni.showToast({
  107. title: res.errmsg,
  108. icon:'none',
  109. duration: 2000
  110. })
  111. });
  112. },
  113. fail: () => {},
  114. complete: () => {}
  115. })
  116. // }
  117. },
  118. releaseChange(e){
  119. this.receivePrivate = e.detail.value
  120. this.release = this.releaseType[this.receivePrivate];
  121. this.pageSize = 1
  122. if(this.release == "我要卖粮"){
  123. uni.navigateTo({
  124. url: `/pageD/myRelease/sellGrain`
  125. })
  126. }else if(this.release == "我要买粮"){
  127. uni.navigateTo({
  128. url: `/pageD/myRelease/buyGrain`
  129. })
  130. }
  131. },
  132. details(item){
  133. uni.navigateTo({
  134. url: `/pageD/myRelease/buyDetails?id=${item.id}`
  135. })
  136. },
  137. getList(){
  138. // this.procurementPlanInfo.pcFlag = "1"
  139. this.$api.doRequest('get','/procurementPlanInfo/selectProcurementPlanInfo',this.procurementPlanInfo).then(res => {
  140. this.procurementPlanInfos = res.data.data.records
  141. console.log(this.procurementPlanInfos,"对象")
  142. })
  143. .catch(res => {
  144. uni.showToast({
  145. title: res.errmsg,
  146. icon:'none',
  147. duration: 2000
  148. })
  149. });
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. .center {
  156. padding: 10px 20px;
  157. }
  158. .informations {
  159. /* display: inline-flex; */
  160. }
  161. .labels {
  162. display: inline-flex;
  163. line-height: 20px;
  164. margin-right: 40px;
  165. }
  166. .put{
  167. float: right;
  168. }
  169. .fabuBut{
  170. margin-bottom: 0px;
  171. }
  172. </style>