release.vue 4.2 KB

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