mulDetail.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <div>
  3. <div class="head">
  4. <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
  5. <span>{{ $t('lang321') }}</span>
  6. </div>
  7. <div class="home_page">
  8. <div class="goods_info flex_col">
  9. <img :src="product.thum" alt="" />
  10. <span class="goods_info_title">{{ product.title }}</span>
  11. <div class="flex">
  12. <div class="">
  13. <span class="key">APY:</span>
  14. <span class="value_2">{{ Number(product.income_reta) * 100 }}</span>
  15. </div>
  16. <div class="">
  17. <span class="key">{{ $t('lang332') }}:</span>
  18. <span class="value_1">{{ product.day_num }}</span>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="goods_list">
  23. <div class="goods_list_box">
  24. <!-- <van-checkbox-group v-model="result" ref="checkboxGroup"> -->
  25. <div class="goods_list_box_item flex jsb" v-for="(item, index) in product.product_list" :key="index">
  26. <div class="flex">
  27. <img :src="item.thum" alt="" />
  28. <span class="name">{{ item.name }}</span>
  29. </div>
  30. <div class="flex" @click="chooseProduct(item.id, index)">
  31. <span class="orderSn" v-if="order_no[item.id]">{{ order_no[item.id] }}</span>
  32. <span class="tip" v-else>{{ $t('lang331') }}</span>
  33. <!-- <van-checkbox :name="item.id" icon-size="16px" checked-color="#21926F"> </van-checkbox> -->
  34. <div :class="[order_no[item.id] ? 'checkbox checkbox-active' : 'checkbox']">
  35. <van-icon name="success" size="13px" color="#fff" v-if="order_no[item.id]" />
  36. </div>
  37. </div>
  38. </div>
  39. <!-- </van-checkbox-group> -->
  40. </div>
  41. <div class="desc" v-html="product.detail"></div>
  42. </div>
  43. <div class="btn_box">
  44. <van-button class="btn" @click="submit">{{ $t('lang325') }}</van-button>
  45. </div>
  46. <van-popup v-model="showOrders" round closeable>
  47. <div class="orderpopup">
  48. <div class="orderpopup_title">{{ $t('lang334') }}</div>
  49. <van-radio-group v-model="radio" class="orderpopup_list" v-if="orderlist.length > 0">
  50. <div v-for="(item, index) in orderlist" :key="index" class="orderpopup_item flex jsb">
  51. <span :class="[radio == item ? 'radio-active' : '']">
  52. {{ item.order_no }}
  53. </span>
  54. <van-radio :name="item.order_no" icon-size="18px" checked-color="#21926f"></van-radio>
  55. </div>
  56. </van-radio-group>
  57. <div class="nodata" v-else>
  58. <span>{{ $t('lang60') }} </span>
  59. </div>
  60. <van-button type="default" class="btn" @click="chooseOrder">{{ $t('lang111') }}</van-button>
  61. </div>
  62. </van-popup>
  63. </div>
  64. <van-overlay :show="show">
  65. <div class="wrapper" @click.stop>
  66. <van-loading type="spinner" class="loading" color="#29b286" />
  67. </div>
  68. </van-overlay>
  69. </div>
  70. </template>
  71. <script>
  72. import { mapState } from 'vuex';
  73. import { homeApi } from '@/api/index';
  74. import { Dialog } from 'vant';
  75. export default {
  76. data() {
  77. return {
  78. showOrders: false,
  79. orderlist: [],
  80. page: 1,
  81. radio: {},
  82. product: {},
  83. order_no: {}, // 存放已选择订单
  84. show: false,
  85. };
  86. },
  87. mounted() {
  88. this.getInfo();
  89. },
  90. methods: {
  91. //返回上一页
  92. back() {
  93. this.$router.back();
  94. },
  95. getInfo() {
  96. homeApi.pledgeDetail({ id: this.$route.query.id }).then(res => {
  97. if (res.code == 200) {
  98. this.product = res.data;
  99. } else {
  100. this.$toast(res.msg);
  101. }
  102. });
  103. },
  104. holdProductList(product_id) {
  105. homeApi.holdProductList({ product_id }).then(res => {
  106. if (res.code == 200) {
  107. this.orderlist = res.data;
  108. } else {
  109. this.$toast(res.msg);
  110. }
  111. });
  112. },
  113. chooseProduct(id, index) {
  114. console.log(id, index);
  115. // if (this.result.indexOf(id) >= 0) {
  116. // this.order_no[id] = '';
  117. // this.result.splice(this.result.indexOf(id), 1);
  118. // } else {
  119. this.showOrders = true;
  120. this.holdProductList(id);
  121. this.productId = id;
  122. this.radio = this.order_no[this.productId];
  123. console.log(this.radio);
  124. // }
  125. },
  126. chooseOrder() {
  127. if (!this.radio) {
  128. return this.$toast(this.$t('lang330'));
  129. }
  130. this.order_no[this.productId] = this.radio;
  131. this.showOrders = false;
  132. this.productId = '';
  133. console.log('order_no', this.order_no);
  134. console.log('radio', this.radio);
  135. this.radio = {};
  136. },
  137. submit() {
  138. console.log(Object.assign({}, this.order_no));
  139. if (JSON.stringify(this.order_no) == '{}') {
  140. return this.$toast(this.$t('lang330'));
  141. }
  142. let _this = this;
  143. Dialog.confirm({
  144. title: _this.$t('lang136'),
  145. message: _this.$t('lang327'),
  146. confirmButtonText: _this.$t('lang111'),
  147. cancelButtonText: _this.$t('lang135'),
  148. })
  149. .then(() => {
  150. _this.show = true
  151. let params = { pledge_id: _this.$route.query.id, order_no: Object.assign({}, _this.order_no) };
  152. homeApi.createPledge(params).then(res => {
  153. if (res.code == 200) {
  154. _this.show = false
  155. _this.$toast(_this.$t('lang326'));
  156. _this.$router.push({ name: 'storing' });
  157. } else {
  158. _this.show = false
  159. _this.$toast(res.msg);
  160. }
  161. });
  162. })
  163. .catch(() => {
  164. // on cancel
  165. });
  166. },
  167. },
  168. computed: {
  169. ...mapState(['account']),
  170. },
  171. };
  172. </script>
  173. <style lang="less" scoped>
  174. .head {
  175. position: fixed;
  176. top: 0;
  177. left: 0;
  178. width: 100%;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. color: rgba(#000, 0.8);
  183. letter-spacing: 1.5px;
  184. font-weight: 550;
  185. background: #fff;
  186. padding: 14px 0;
  187. z-index: 99;
  188. .arrow_img {
  189. position: absolute;
  190. left: 20px;
  191. width: 10px;
  192. height: 16px;
  193. // transform: translate(0, -50%);
  194. }
  195. }
  196. .home_page {
  197. min-height: 100vh;
  198. padding: 60px 16px 110px;
  199. .jsb {
  200. justify-content: space-between;
  201. }
  202. .goods_info {
  203. padding: 16px;
  204. border-radius: 10px;
  205. background-color: #fff;
  206. img {
  207. width: 100%;
  208. border-radius: 10px;
  209. }
  210. &_title {
  211. font-size: 16px;
  212. font-weight: 600;
  213. color: #000;
  214. letter-spacing: 1px;
  215. padding: 13px 0 10px;
  216. }
  217. .value_1 {
  218. color: #29b286;
  219. font-size: 18px;
  220. font-weight: 600;
  221. }
  222. .value_1::after {
  223. content: 'TeaC';
  224. font-size: 13px;
  225. font-weight: normal;
  226. }
  227. .value_2::after {
  228. content: '%';
  229. font-size: 13px;
  230. font-weight: normal;
  231. }
  232. .value_2 {
  233. color: #ed5111;
  234. font-size: 18px;
  235. font-weight: 600;
  236. padding-right: 50px;
  237. }
  238. .key {
  239. color: #4b4b4b;
  240. font-size: 12px;
  241. padding-top: 10px;
  242. }
  243. }
  244. .goods_list {
  245. color: #000;
  246. padding: 16px;
  247. border-radius: 10px;
  248. margin-top: 16px;
  249. background-color: #fff;
  250. &_box {
  251. padding-bottom: 8px;
  252. &_item {
  253. padding-bottom: 8px;
  254. img {
  255. width: 45px;
  256. height: 45px;
  257. border-radius: 50%;
  258. }
  259. .name {
  260. font-size: 14px;
  261. width: 90px;
  262. margin-left: 6px;
  263. white-space: nowrap;
  264. overflow: hidden;
  265. text-overflow: ellipsis;
  266. }
  267. .tip {
  268. color: #b9b9b9;
  269. font-size: 12px;
  270. padding-right: 6px;
  271. }
  272. .orderSn {
  273. color: #000;
  274. font-size: 12px;
  275. padding-right: 6px;
  276. }
  277. .checkbox {
  278. width: 16px;
  279. height: 16px;
  280. border-radius: 50%;
  281. border: 0.0625rem solid #c8c9cc;
  282. }
  283. .checkbox-active {
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. background-color: #21926f;
  288. }
  289. }
  290. }
  291. .desc {
  292. font-size: 14px;
  293. line-height: 160%;
  294. letter-spacing: 1px;
  295. padding-top: 16px;
  296. }
  297. }
  298. .btn_box {
  299. position: fixed;
  300. bottom: 0;
  301. left: 0;
  302. right: 0;
  303. padding: 20px;
  304. background-color: #fff;
  305. .btn {
  306. width: 100%;
  307. color: #fff;
  308. letter-spacing: 2px;
  309. border-radius: 20px;
  310. background-color: #29b286;
  311. }
  312. }
  313. .nodata {
  314. font-size: 13px;
  315. padding: 60px;
  316. color: #4b4b4b;
  317. text-align: center;
  318. }
  319. .orderpopup {
  320. width: 300px;
  321. height: fit-content;
  322. color: #000;
  323. padding: 16px 30px 0;
  324. &_title {
  325. text-align: center;
  326. }
  327. &_list {
  328. min-height: 100px;
  329. max-height: 160px;
  330. margin: 28px 0 10px;
  331. overflow: auto;
  332. }
  333. &_item {
  334. color: #9b9b9b;
  335. font-size: 15px;
  336. padding-bottom: 10px;
  337. .radio-active {
  338. color: #000;
  339. }
  340. }
  341. .btn {
  342. width: 100%;
  343. color: #21926f;
  344. letter-spacing: 2px;
  345. border: 0;
  346. border-top: 1px solid rgba(#cccccc, 0.8);
  347. border-radius: 0;
  348. background-color: #fff;
  349. }
  350. }
  351. }
  352. .flex {
  353. display: flex;
  354. align-items: center;
  355. }
  356. .flex_col {
  357. display: flex;
  358. flex-direction: column;
  359. }
  360. .flex_end {
  361. align-items: flex-end;
  362. }
  363. ::v-deep .van-popup__close-icon {
  364. color: #575757;
  365. }
  366. .wrapper {
  367. // display: flex;
  368. // justify-content: center;
  369. .loading {
  370. position: absolute;
  371. left: 46%;
  372. top: 46%;
  373. }
  374. }
  375. </style>