release.vue 9.5 KB

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