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. console.log("release.vue onload")
  49. this.getList()
  50. },
  51. methods: {
  52. switch1(item){
  53. console.log(125489)
  54. // if (!this.hasLogin) {
  55. uni.showModal({
  56. // title: '登录提示',
  57. content: '隐藏后该信息不再展示给其他用户,是否确定隐藏?',
  58. showCancel: true,
  59. confirmText: '确定',
  60. success: (e) => {
  61. this.$api.doRequest('post','/procurementPlanInfo/api/editStatus',{id:item.id,flag:0}).then(res => {
  62. this.procurementPlanInfos = res.data.data.records
  63. if (res.errmsg == "Success") {
  64. this.$api.msg('隐藏成功!')
  65. return
  66. }
  67. })
  68. .catch(res => {
  69. uni.showToast({
  70. title: res.errmsg,
  71. icon:'none',
  72. duration: 2000
  73. })
  74. });
  75. },
  76. fail: () => {},
  77. complete: () => {}
  78. })
  79. // }
  80. },
  81. deleteRelease(item){
  82. // if (!this.hasLogin) {
  83. uni.showModal({
  84. // title: '登录提示',
  85. content: '确定删除该信息?',
  86. showCancel: true,
  87. confirmText: '确定',
  88. success: (e) => {
  89. this.$api.doRequest('post','/procurementPlanInfo/api/deleteProcurementPlan',{id:item.id}).then(res => {
  90. this.procurementPlanInfos = res.data.data.records
  91. if (res.errmsg == "Success") {
  92. this.$api.msg('删除成功!')
  93. this.getList()
  94. return
  95. }
  96. })
  97. .catch(res => {
  98. uni.showToast({
  99. title: res.errmsg,
  100. icon:'none',
  101. duration: 2000
  102. })
  103. });
  104. },
  105. fail: () => {},
  106. complete: () => {}
  107. })
  108. // }
  109. },
  110. releaseChange(e){
  111. this.receivePrivate = e.detail.value
  112. this.release = this.releaseType[this.receivePrivate];
  113. this.pageSize = 1
  114. if(this.release == "我要卖粮"){
  115. uni.navigateTo({
  116. url: `/pageD/myRelease/sellGrain`
  117. })
  118. }else if(this.release == "我要买粮"){
  119. uni.navigateTo({
  120. url: `/pageD/myRelease/buyGrain`
  121. })
  122. }
  123. },
  124. details(item){
  125. uni.navigateTo({
  126. url: `/pageD/myRelease/buyDetails?id=${item.id}`
  127. })
  128. },
  129. getList(){
  130. // this.procurementPlanInfo.pcFlag = "1"
  131. this.$api.doRequest('get','/procurementPlanInfo/selectProcurementPlanInfo',this.procurementPlanInfo).then(res => {
  132. this.procurementPlanInfos = res.data.data.records
  133. console.log(this.procurementPlanInfos,"对象")
  134. })
  135. .catch(res => {
  136. uni.showToast({
  137. title: res.errmsg,
  138. icon:'none',
  139. duration: 2000
  140. })
  141. });
  142. }
  143. }
  144. }
  145. </script>
  146. <style>
  147. .center {
  148. padding: 10px 20px;
  149. }
  150. .informations {
  151. /* display: inline-flex; */
  152. }
  153. .labels {
  154. display: inline-flex;
  155. line-height: 20px;
  156. margin-right: 40px;
  157. }
  158. .put{
  159. float: right;
  160. }
  161. .fabuBut{
  162. margin-bottom: 0px;
  163. }
  164. </style>