release.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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: (e) => {
  173. this.$api.doRequest('post', '/procurementPlanInfo/api/deleteProcurementPlan', {
  174. id: item.id
  175. }).then(res => {
  176. if (res.data.message == "Success") {
  177. this.$api.msg('删除成功!')
  178. this.getList()
  179. return
  180. }
  181. })
  182. .catch(res => {
  183. uni.showToast({
  184. title: res.errmsg,
  185. icon: 'none',
  186. duration: 2000
  187. })
  188. });
  189. },
  190. fail: () => {},
  191. complete: () => {}
  192. })
  193. } else if (item.type == "卖粮") {
  194. uni.showModal({
  195. // title: '登录提示',
  196. content: '确定删除该信息?',
  197. showCancel: true,
  198. confirmText: '确定',
  199. success: (e) => {
  200. this.$api.doRequest('post', '/salePlanInfo/api/deleteSalePlanInfo', {
  201. id: item.id
  202. }).then(res => {
  203. if (res.data.message == "Success") {
  204. this.$api.msg('删除成功!')
  205. this.getList()
  206. return
  207. }
  208. })
  209. .catch(res => {
  210. uni.showToast({
  211. title: res.errmsg,
  212. icon: 'none',
  213. duration: 2000
  214. })
  215. });
  216. },
  217. fail: () => {},
  218. complete: () => {}
  219. })
  220. }
  221. },
  222. releaseChange(e) {
  223. this.receivePrivate = e.detail.value
  224. this.release = this.releaseType[this.receivePrivate];
  225. this.pageSize = 1
  226. if (this.release == "我要卖粮") {
  227. uni.navigateTo({
  228. url: `/pageD/myRelease/sellGrain`
  229. })
  230. } else if (this.release == "我要买粮") {
  231. uni.navigateTo({
  232. url: `/pageD/myRelease/buyGrain`
  233. })
  234. }
  235. },
  236. details(item) {
  237. if (item.type == "买粮") {
  238. uni.navigateTo({
  239. url: `/pageD/myRelease/buyDetails?id=${item.id}`
  240. })
  241. } else if (item.type == "卖粮") {
  242. uni.navigateTo({
  243. url: `/pageD/myRelease/sellDetails?id=${item.id}`
  244. })
  245. }
  246. },
  247. getList() {
  248. // this.procurementPlanInfo.pcFlag = "1"
  249. this.procurementPlanInfo.commonId = this.userInfo.id
  250. this.$api.doRequest('get', '/procurementPlanInfo/selectProcurementPlanInfoAPP', this.procurementPlanInfo)
  251. .then(res => {
  252. this.procurementPlanInfos = res.data.data.records
  253. })
  254. .catch(res => {
  255. uni.showToast({
  256. title: res.errmsg,
  257. icon: 'none',
  258. duration: 2000
  259. })
  260. });
  261. }
  262. }
  263. }
  264. </script>
  265. <style>
  266. .center {
  267. padding: 10px 20px;
  268. background-color: #F5F6FA;
  269. }
  270. .informations {
  271. background-color: #FFFFFF;
  272. margin-top: 20px;
  273. border-radius: 16px;
  274. padding: 10px;
  275. }
  276. .labels {
  277. display: inline-flex;
  278. line-height: 20px;
  279. margin-right: 40px;
  280. }
  281. .fabuBut {
  282. margin-bottom: 0px;
  283. }
  284. .logo {
  285. width: 36px;
  286. height: 24px;
  287. background-color: #FEECE6;
  288. color: #FE6430;
  289. border-radius: 8px;
  290. padding: 3px;
  291. margin-top: 2px;
  292. }
  293. .logo1 {
  294. width: 36px;
  295. height: 24px;
  296. background-color: #E9F8F0;
  297. color: #22C572;
  298. border-radius: 8px;
  299. padding: 3px;
  300. margin-top: 2px;
  301. }
  302. .grain {
  303. font-size: 18px;
  304. color: #333333;
  305. font-weight: 600;
  306. margin-left: 20px;
  307. }
  308. .address {
  309. margin-left: 56px;
  310. font-size: 14px;
  311. color: #333333;
  312. }
  313. .weight {
  314. margin-left: 56px;
  315. font-size: 14px;
  316. color: #878C9C;
  317. }
  318. .unitPrice {
  319. font-size: 22px;
  320. font-weight: 600;
  321. /* margin-left: 200px; */
  322. position: absolute;
  323. /* text-align: right; */
  324. right: 40px;
  325. }
  326. /* .amount{
  327. width: 100%;
  328. } */
  329. .amount {
  330. margin-left: 10px;
  331. font-size: 12px;
  332. }
  333. .status {
  334. position: absolute;
  335. right: 40px;
  336. }
  337. .put {
  338. color: #22C572;
  339. font-size: 14px;
  340. }
  341. .put1 {
  342. color: #FE6430;
  343. font-size: 14px;
  344. }
  345. .put2 {
  346. color: #FB1E1E;
  347. font-size: 14px;
  348. }
  349. .anniu {
  350. width: 60px;
  351. height: 30px;
  352. border: 1px solid #CDCDCD;
  353. border-radius: 16px;
  354. text-align: center;
  355. line-height: 30px;
  356. margin-left: 10px;
  357. }
  358. .btn {
  359. width: 100%;
  360. border-radius: 20px;
  361. background-color: #22C572;
  362. margin-top: 10px;
  363. }
  364. </style>