purchase.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="">
  3. <!-- <view class="">
  4. 买入
  5. </view> -->
  6. <view class="jg" style="height: 20rpx;"></view>
  7. <empty v-if="loaded === true && list.length === 0"></empty>
  8. <view class="buy-item" v-for="item in list" v-if="item.status !== -1">
  9. <view class="item-top">
  10. <view class="top-left">
  11. <image src="../../static/icon/mrlogo.png" mode=""></image><text class="top-name clamp">{{item.order_id}}</text>
  12. </view>
  13. <view class="top-right">
  14. {{item.status | status}}
  15. </view>
  16. </view>
  17. <view class="item-info">
  18. <view class="info-data">
  19. <view class="info-tit">收益:</view>
  20. <view class="info-val">{{item.day}}天/{{item.proportion}}%</view>
  21. </view>
  22. <!-- <view class="info-data">
  23. <view class="info-tit">:</view>
  24. <view class="info-val">10:20</view>
  25. </view> -->
  26. <view class="info-data">
  27. <view class="info-tit">可获通证:</view>
  28. <view class="info-val">1.0%</view>
  29. </view>
  30. <view class="info-data">
  31. <view class="info-tit">价值:</view>
  32. <view class="info-val">{{item.price}}</view>
  33. </view>
  34. <view class="btn-wrap flex" v-if="item.status == 1 || item.status == 2">
  35. <view class="btn" @click="open(item.order_id)">
  36. 提交凭证
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <uni-load-more :status="loadingType"></uni-load-more>
  42. <uni-popup ref="popup1" type="center" :maskClick="false">
  43. <view class="upload-wrap">
  44. <view class="tit">
  45. 上传支付凭证
  46. </view>
  47. <view class="up-wrap" @click="imgsub('upimg')">
  48. <image :src="upimg" mode="" v-if="upimg"></image>
  49. <image v-else src="../../static/img/upimg.png" mode=""></image>
  50. </view>
  51. <view class="btn-wrap">
  52. <view class="btn qx" @click="qx">
  53. 取消
  54. </view>
  55. <view class="btn" @click="evaluationUpload">提交</view>
  56. </view>
  57. </view>
  58. </uni-popup>
  59. <!-- <u-tabbar v-model="current" :list="tabbar" active-color="#FF0000" inactive-color="#f19c99"></u-tabbar> -->
  60. </view>
  61. </template>
  62. <script>
  63. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  64. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  65. import empty from '@/components/empty';
  66. import { packageMyReserveList, evaluationUpload } from '@/api/package.js'
  67. import { upload } from '@/api/user.js';
  68. import {
  69. tabbar,tabbar1
  70. } from "@/utils/tabbar.js";
  71. export default {
  72. components: {
  73. uniLoadMore,
  74. empty,
  75. uniPopup
  76. },
  77. filters: {
  78. status(val) {
  79. let str = ''
  80. // 状态:0-预约,1-待支付,2-待审核,3-释放中,4-释放完成,5-重新发放,6-完成,-1-没抢到,-2-审核无效
  81. switch (val) {
  82. case 0:
  83. str = '预约'
  84. break;
  85. case 1:
  86. str = '待支付'
  87. break;
  88. case 2:
  89. str = '待审核'
  90. break;
  91. case 3:
  92. str = '释放中'
  93. break;
  94. case 4:
  95. str = '释放完成'
  96. break;
  97. case 5:
  98. str = '已完成'
  99. break;
  100. case 6:
  101. str = '已完成'
  102. break;
  103. case -1:
  104. str = '没抢到'
  105. break;
  106. case -2:
  107. str = '审核无效'
  108. break;
  109. default:
  110. str = ''
  111. }
  112. return str
  113. }
  114. },
  115. data() {
  116. return {
  117. tabbar: tabbar,
  118. tabbar1: tabbar1,
  119. current: 1,
  120. list: [],
  121. loadingType: 'more',
  122. page: 1,
  123. limit: 20,
  124. loaded: false,
  125. choose_order: '',
  126. upimg: '',
  127. }
  128. },
  129. onLoad() {
  130. console.log('买入')
  131. // this.$refs.upload.open()
  132. this.loadData()
  133. // this.$refs.popup1.open()
  134. },
  135. //上拉加载更多
  136. onReachBottom() {
  137. this.loadData()
  138. },
  139. methods: {
  140. qx() {
  141. this.upimg = ''
  142. this.choose_order = ''
  143. this.$refs.popup1.close()
  144. },
  145. imgsub(text) {
  146. console.log('imgsub');
  147. upload({
  148. filename: ''
  149. }).then(data => {
  150. // this.upimg = data[0].url;
  151. this.$set(this,text,data[0].url)
  152. });
  153. },
  154. open(orderId) {
  155. this.choose_order = orderId
  156. this.$refs.popup1.open()
  157. },
  158. navto(url) {
  159. uni.navigateTo({
  160. url: url
  161. })
  162. },
  163. loadData() {
  164. let obj = this
  165. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  166. return
  167. }
  168. obj.loadingType = 'loading'
  169. packageMyReserveList({
  170. page: obj.page,
  171. limit: obj.limit,
  172. status: 3
  173. }).then( ({data}) => {
  174. obj.list = obj.list.concat(data.data)
  175. this.page++
  176. if (data.data.length == obj.limit) {
  177. obj.loadingType = 'more'
  178. } else {
  179. obj.loadingType = 'noMore'
  180. }
  181. obj.$set(obj, 'loaded', true)
  182. })
  183. },
  184. //提交审核
  185. evaluationUpload() {
  186. let obj = this
  187. evaluationUpload({
  188. pay_evaluation: obj.upimg,
  189. id: obj.choose_order
  190. }).then( res => {
  191. this.qx()
  192. uni.showToast({
  193. title:'提交成功',
  194. duration:2000
  195. });
  196. this.page = 1
  197. this.list = []
  198. this.loadingType = 'more'
  199. this.loadData()
  200. console.log(res,'上传凭证+++++')
  201. })
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .buy-item {
  208. width: 690rpx;
  209. // height: 235rpx;
  210. margin: 0 auto 20rpx;
  211. background: #FFFFFF;
  212. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  213. border-radius: 20rpx;
  214. padding: 26rpx 30rpx;
  215. .item-top {
  216. display: flex;
  217. justify-content: space-between;
  218. height: 50rpx;
  219. .top-left {
  220. font-size: 34rpx;
  221. font-family: PingFang SC;
  222. font-weight: bold;
  223. color: #0F253A;
  224. line-height: 50rpx;
  225. display: flex;
  226. align-items: center;
  227. image {
  228. width: 48rpx;
  229. height: 46rpx;
  230. }
  231. .top-name {
  232. width: 450rpx;
  233. padding-left: 11rpx;
  234. }
  235. }
  236. .top-right {
  237. line-height: 50rpx;
  238. width: 100rpx;
  239. text-align: right;
  240. font-size: 26rpx;
  241. font-family: PingFang SC;
  242. font-weight: 500;
  243. color: #6D7C88;
  244. }
  245. }
  246. .item-info {
  247. width: 100%;
  248. margin-top: 28rpx;
  249. line-height: 50rpx;
  250. font-size: 26rpx;
  251. font-family: PingFang SC;
  252. display: flex;
  253. flex-wrap: wrap;
  254. .info-data {
  255. width: 50%;
  256. display: flex;
  257. .info-tit {
  258. font-weight: 500;
  259. color: #6D7C88;
  260. }
  261. .info-val {
  262. color: #0F253A;
  263. font-weight: bold;
  264. }
  265. }
  266. .btn-wrap {
  267. padding-top: 20rpx;
  268. width: 100%;
  269. justify-content: flex-end;
  270. .btn {
  271. text-align: center;
  272. width: 144rpx;
  273. line-height: 50rpx;
  274. background: #FFFFFF;
  275. border: 2rpx solid #FF4C4C;
  276. border-radius: 25rpx;
  277. font-size: 26rpx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #FF4C4C;
  281. }
  282. }
  283. }
  284. }
  285. .upload-wrap {
  286. width: 500rpx;
  287. height: 500rpx;
  288. background-color: #fff;
  289. border-radius: 20rpx;
  290. .tit {
  291. padding: 30rpx 25rpx;
  292. text-align: center;
  293. font-size: 32rpx;
  294. font-family: PingFang SC;
  295. font-weight: bold;
  296. color: #101010;
  297. }
  298. .up-wrap {
  299. margin:auto;
  300. width: 225rpx;
  301. height: 225rpx;
  302. background: #FFFFFF;
  303. border-radius: 10rpx;
  304. image {
  305. width: 225rpx;
  306. height: 225rpx;
  307. border-radius: 10rpx;
  308. }
  309. }
  310. .btn-wrap {
  311. display: flex;
  312. .btn {
  313. margin: 50rpx auto 0;
  314. width: 150rpx;
  315. line-height: 84rpx;
  316. background: linear-gradient(30deg, #FF4C4C, #FE6238);
  317. border-radius: 10rpx;
  318. font-size: 32rpx;
  319. font-family: PingFang SC;
  320. font-weight: bold;
  321. color: #FFFFFF;
  322. text-align: center;
  323. }
  324. .qx {
  325. background: #fff;
  326. border: 1px solid #999;
  327. color: #999;
  328. }
  329. }
  330. }
  331. </style>