release.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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="flex">
  7. <view class="logo flex" v-if="item.type == '买粮'">{{item.type}}</view>
  8. <view class="logo1 flex" v-if="item.type == '卖粮'">{{item.type}}</view>
  9. <!-- <view class="logo flex" >买粮{{item.planType}}</view> -->
  10. <text class="grain">{{item.goodsName}}</text>
  11. <view class="status">
  12. <view v-if='item.status=="已驳回"' class='put2'>未通过</view>
  13. <view v-if='item.status=="待审核"' class='put1'>审核中</view>
  14. <view v-if='item.status=="已认证"' class='put'>已通过</view>
  15. </view>
  16. </view>
  17. <view class="address">{{item.receivePrivate}}{{item.receiveCity}}{{item.receiveArea}}</view>
  18. <view class="flex ">
  19. <view class="weight">{{item.weight > 0 ? item.weight : 0}}吨</view>
  20. <text class="unitPrice">{{item.unitPrice}} <text class="amount">元/吨</text></text>
  21. </view>
  22. </view>
  23. <hr style="margin: 16px 0; color: #EEEEEE;">
  24. <view class="flex" style="right: 10px;">
  25. <view @click='edit(item)' v-if='item.status!="待审核"' class='anniu'>编辑</view>
  26. <view class='anniu' @click="switch1(item)" v-if="item.showFlag == 0">隐藏</view>
  27. <view class='anniu' @click="switch1(item)" v-if="item.showFlag == 1">显示</view>
  28. <view class='anniu' @click="deleteRelease(item)">删除</view>
  29. </view>
  30. </view>
  31. </view>
  32. <picker style='display:inline-block;width: 100%;' @change="releaseChange" :value="releases"
  33. :range="releaseType">
  34. <button type="primary" class="btn">发布</button>
  35. <view class="picker">
  36. {{releases>-1?releaseType[releases]:''}}
  37. </view>
  38. </picker>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. mapState
  44. } from 'vuex';
  45. export default {
  46. data() {
  47. return {
  48. releaseType: ["我要卖粮", "我要买粮"],
  49. release: '',
  50. releases: '',
  51. receivePrivate: '',
  52. procurementPlanInfo: {
  53. pageSize: 10,
  54. currentPage: 1
  55. },
  56. releaseIndex: "",
  57. pageSize: 10,
  58. currentPage: 1,
  59. procurementPlanInfos: [],
  60. }
  61. },
  62. onLoad() {
  63. this.getList()
  64. },
  65. computed: {
  66. ...mapState(['hasLogin', 'userInfo'])
  67. },
  68. methods: {
  69. switch1(item) {
  70. if (item.type == "买粮") {
  71. var that = this
  72. var tips
  73. if (item.showFlag == 0) {
  74. tips = "隐藏后该信息不再展示给其他用户,是否确定隐藏?"
  75. } else if (item.showFlag == 1) {
  76. tips = "确定显示该信息?"
  77. }
  78. uni.showModal({
  79. content: tips,
  80. showCancel: true,
  81. confirmText: '确定',
  82. success: function(res) {
  83. if (res.confirm) {
  84. that.$api.doRequest('post', '/procurementPlanInfo/api/editStatus', {
  85. id: item.id,
  86. flag: 0
  87. }).then(res => {
  88. // this.procurementPlanInfos = res.data.data.records
  89. if (res.data.message == "Success") {
  90. if (item.showFlag == 0) {
  91. that.$api.msg('隐藏成功!')
  92. } else if (item.showFlag == 1) {
  93. that.$api.msg('显示成功!')
  94. }
  95. that.getList()
  96. return
  97. }
  98. })
  99. .catch(res => {
  100. uni.showToast({
  101. title: res.errmsg,
  102. icon: 'none',
  103. duration: 2000
  104. })
  105. });
  106. } else if (res.cancel) {
  107. // console.log('用户点击取消');
  108. }
  109. },
  110. })
  111. } else if (item.type == "卖粮") {
  112. var that = this
  113. var tips
  114. if (item.showFlag == 0) {
  115. tips = "隐藏后该信息不再展示给其他用户,是否确定隐藏?"
  116. } else if (item.showFlag == 1) {
  117. tips = "确定显示该信息?"
  118. }
  119. uni.showModal({
  120. content: tips,
  121. showCancel: true,
  122. confirmText: '确定',
  123. success: function(res) {
  124. if (res.confirm) {
  125. that.$api.doRequest('post', '/salePlanInfo/api/editStatus', {
  126. id: item.id,
  127. flag: 0
  128. }).then(res => {
  129. // this.procurementPlanInfos = res.data.data.records
  130. if (res.data.message == "Success") {
  131. if (item.showFlag == 0) {
  132. that.$api.msg('隐藏成功!')
  133. } else if (item.showFlag == 1) {
  134. that.$api.msg('显示成功!')
  135. }
  136. that.getList()
  137. return
  138. }
  139. })
  140. .catch(res => {
  141. uni.showToast({
  142. title: res.errmsg,
  143. icon: 'none',
  144. duration: 2000
  145. })
  146. });
  147. } else if (res.cancel) {
  148. // console.log('用户点击取消');
  149. }
  150. },
  151. })
  152. }
  153. },
  154. edit(item) {
  155. if (item.type == "买粮") {
  156. uni.navigateTo({
  157. url: `/pageD/myRelease/buyEdit?id=${item.id}`
  158. })
  159. } else if (item.type == "卖粮") {
  160. uni.navigateTo({
  161. url: `/pageD/myRelease/sellEdit?id=${item.id}`
  162. })
  163. }
  164. },
  165. deleteRelease(item) {
  166. if (item.type == "买粮") {
  167. uni.showModal({
  168. // title: '登录提示',
  169. content: '确定删除该信息?',
  170. showCancel: true,
  171. confirmText: '确定',
  172. success: function(res) {
  173. if (res.confirm) {
  174. this.$api.doRequest('post', '/procurementPlanInfo/api/deleteProcurementPlan', {
  175. id: item.id
  176. }).then(res => {
  177. if (res.data.message == "Success") {
  178. this.$api.msg('删除成功!')
  179. this.getList()
  180. return
  181. }
  182. })
  183. .catch(res => {
  184. uni.showToast({
  185. title: res.errmsg,
  186. icon: 'none',
  187. duration: 2000
  188. })
  189. });
  190. } else if (res.cancel) {
  191. // console.log('用户点击取消');
  192. }
  193. },
  194. fail: () => {},
  195. complete: () => {}
  196. })
  197. } else if (item.type == "卖粮") {
  198. uni.showModal({
  199. // title: '登录提示',
  200. content: '确定删除该信息?',
  201. showCancel: true,
  202. confirmText: '确定',
  203. success: function(res) {
  204. if (res.confirm) {
  205. this.$api.doRequest('post', '/salePlanInfo/api/deleteSalePlanInfo', {
  206. id: item.id
  207. }).then(res => {
  208. if (res.data.message == "Success") {
  209. this.$api.msg('删除成功!')
  210. this.getList()
  211. return
  212. }
  213. })
  214. .catch(res => {
  215. uni.showToast({
  216. title: res.errmsg,
  217. icon: 'none',
  218. duration: 2000
  219. })
  220. });
  221. } else if (res.cancel) {
  222. // console.log('用户点击取消');
  223. }
  224. },
  225. fail: () => {},
  226. complete: () => {}
  227. })
  228. }
  229. },
  230. releaseChange(e) {
  231. this.receivePrivate = e.detail.value
  232. this.release = this.releaseType[this.receivePrivate];
  233. this.pageSize = 1
  234. if (this.release == "我要卖粮") {
  235. uni.navigateTo({
  236. url: `/pageD/myRelease/sellGrain`
  237. })
  238. } else if (this.release == "我要买粮") {
  239. uni.navigateTo({
  240. url: `/pageD/myRelease/buyGrain`
  241. })
  242. }
  243. },
  244. details(item) {
  245. if (item.type == "买粮") {
  246. uni.navigateTo({
  247. url: `/pageD/myRelease/buyDetails?id=${item.id}`
  248. })
  249. } else if (item.type == "卖粮") {
  250. uni.navigateTo({
  251. url: `/pageD/myRelease/sellDetails?id=${item.id}`
  252. })
  253. }
  254. },
  255. getList() {
  256. // this.procurementPlanInfo.pcFlag = "1"
  257. this.procurementPlanInfo.commonId = this.userInfo.id
  258. this.$api.doRequest('get', '/procurementPlanInfo/selectProcurementPlanInfoAPP', this.procurementPlanInfo)
  259. .then(res => {
  260. this.procurementPlanInfos = res.data.data.records
  261. })
  262. .catch(res => {
  263. uni.showToast({
  264. title: res.errmsg,
  265. icon: 'none',
  266. duration: 2000
  267. })
  268. });
  269. }
  270. }
  271. }
  272. </script>
  273. <style>
  274. .center {
  275. padding: 10px 20px;
  276. background-color: #F5F6FA;
  277. }
  278. .informations {
  279. background-color: #FFFFFF;
  280. margin-top: 20px;
  281. border-radius: 16px;
  282. padding: 10px;
  283. }
  284. .labels {
  285. display: inline-flex;
  286. line-height: 20px;
  287. margin-right: 40px;
  288. }
  289. .fabuBut {
  290. margin-bottom: 0px;
  291. }
  292. .logo {
  293. width: 36px;
  294. height: 24px;
  295. background-color: #FEECE6;
  296. color: #FE6430;
  297. border-radius: 8px;
  298. padding: 3px;
  299. margin-top: 2px;
  300. }
  301. .logo1 {
  302. width: 36px;
  303. height: 24px;
  304. background-color: #E9F8F0;
  305. color: #22C572;
  306. border-radius: 8px;
  307. padding: 3px;
  308. margin-top: 2px;
  309. }
  310. .grain {
  311. font-size: 18px;
  312. color: #333333;
  313. font-weight: 600;
  314. margin-left: 20px;
  315. }
  316. .address {
  317. margin-left: 56px;
  318. font-size: 14px;
  319. color: #333333;
  320. }
  321. .weight {
  322. margin-left: 56px;
  323. font-size: 14px;
  324. color: #878C9C;
  325. }
  326. .unitPrice {
  327. font-size: 22px;
  328. font-weight: 600;
  329. /* margin-left: 200px; */
  330. position: absolute;
  331. /* text-align: right; */
  332. right: 40px;
  333. }
  334. /* .amount{
  335. width: 100%;
  336. } */
  337. .amount {
  338. margin-left: 10px;
  339. font-size: 12px;
  340. }
  341. .status {
  342. position: absolute;
  343. right: 40px;
  344. }
  345. .put {
  346. color: #22C572;
  347. font-size: 14px;
  348. }
  349. .put1 {
  350. color: #FE6430;
  351. font-size: 14px;
  352. }
  353. .put2 {
  354. color: #FB1E1E;
  355. font-size: 14px;
  356. }
  357. .anniu {
  358. width: 60px;
  359. height: 30px;
  360. border: 1px solid #CDCDCD;
  361. border-radius: 16px;
  362. text-align: center;
  363. line-height: 30px;
  364. margin-left: 10px;
  365. }
  366. .btn {
  367. width: 100%;
  368. border-radius: 20px;
  369. background-color: #22C572;
  370. margin-top: 10px;
  371. }
  372. </style>