release.vue 4.1 KB

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