release.vue 9.4 KB

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