receive.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <template>
  2. <view class="gift-package" v-if="!loadding">
  3. <view class="top-tabbar">
  4. <block v-if="hasType('10')">
  5. <view :class="tab_type == 0 ? 'tab-item active' : 'tab-item'" @click="tabFunc(0)">快递配送</view>
  6. </block>
  7. <block v-if="hasType('20')">
  8. <view :class="tab_type == 1 ? 'tab-item active' : 'tab-item'" @click="tabFunc(1)">上门自提</view>
  9. </block>
  10. </view>
  11. <Myinfo v-if="tab_type == 0" :Address="Address" :exist_address="exist_address"></Myinfo>
  12. <Storeinfo v-if="tab_type == 1" ref="getShopinfoData" :extract_store="extract_store"
  13. :last_extract="last_extract"></Storeinfo>
  14. <view class="gift-package-main">
  15. <view class="">
  16. <view class="p-0-30" v-if="detail">
  17. <view class="cuopon-group" if="detail.is_coupon">
  18. <view class="body">
  19. <view class="item mb30 borbox bg-white">
  20. <view class="d-s-c">
  21. <view>
  22. <image v-if="detail.image" class="product_img" :src="detail.image[0].file_path" mode="aspectFill">
  23. </image>
  24. </view>
  25. <view class="pro">
  26. <view class="pro_t">{{detail.product_name}}</view>
  27. <view class="pro_c" v-if="detail.spec_name&&detail.product_multi_spec!=false">
  28. {{detail.spec_name}}
  29. </view>
  30. <view class="pro_c" v-if="!detail.spec_name&&detail.product_multi_spec!=false">
  31. 请选择规格
  32. </view>
  33. <view class="d-b-c">
  34. <view class="pro_b"><text class="f18">¥</text>{{detail.product_price}}
  35. </view>
  36. <view class="speci" v-if="detail.product_multi_spec!=false"
  37. @click="openPopup('order',detail.product_multi_spec,detail)">选规格</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="btns d-e-c">
  48. <button @click="onPay()" class="mr20">确认</button>
  49. </view>
  50. <!--购物确定-->
  51. <spec :isPopup="isPopup" :productModel="productModel" @close="closePopup"></spec>
  52. </view>
  53. </template>
  54. <script>
  55. import Myinfo from './part/my-info';
  56. import Storeinfo from './part/store-info';
  57. import spec from './part/spec.vue';
  58. import utils from '@/common/utils.js';
  59. export default {
  60. components: {
  61. Myinfo,
  62. Storeinfo,
  63. spec
  64. },
  65. data() {
  66. return {
  67. record_id: 0,
  68. /*是否加载完成*/
  69. loadding: true,
  70. indicatorDots: true,
  71. autoplay: true,
  72. interval: 2000,
  73. duration: 500,
  74. id: 0,
  75. tab_type: 0,
  76. /*礼包详情*/
  77. detail: {
  78. name: '',
  79. point: '',
  80. money: '',
  81. coupon_list: [],
  82. },
  83. store_id: 0,
  84. // 是否存在收货地址
  85. exist_address: false,
  86. /*默认地址*/
  87. Address: null,
  88. /* 配送类别 */
  89. delivery: 10,
  90. extract_store: {},
  91. last_extract: {},
  92. chooseProlist: [],
  93. /*子级页面传参*/
  94. productModel: {},
  95. /*规格选择弹窗*/
  96. isPopup: false,
  97. /*已经选择的规格*/
  98. alreadyChioce: {},
  99. code: 0,
  100. /* 点击的商品规格 */
  101. chooseSpecData: null,
  102. /*点击的商品详情*/
  103. chooseDetail: {
  104. product_sku: {},
  105. show_sku: {
  106. product_price: '',
  107. product_sku_id: 0,
  108. line_price: '',
  109. stock_num: 0,
  110. sku_image: ''
  111. }
  112. },
  113. product_sku_id: 0,
  114. deliverySetting: []
  115. }
  116. },
  117. onLoad(e) {
  118. let self = this;
  119. let scene = utils.getSceneData(e);
  120. self.$fire.on('selectStoreId', function(store_id) {
  121. self.store_id = store_id;
  122. });
  123. /*商品id*/
  124. this.record_id = e.record_id;
  125. this.code = e.code;
  126. },
  127. onShow() {
  128. this.getData();
  129. },
  130. methods: {
  131. onPay() {
  132. let self = this;
  133. uni.showLoading({
  134. title: '加载中'
  135. })
  136. let params = {
  137. record_id: self.record_id,
  138. product_sku_id: self.product_sku_id,
  139. delivery_type: self.delivery,
  140. extract: ''
  141. }
  142. let _phone=''
  143. let _linkman=''
  144. if (self.$refs != null) {
  145. if (self.$refs.getShopinfoData != null) {
  146. _phone = self.$refs.getShopinfoData.phone;
  147. _linkman = self.$refs.getShopinfoData.linkman;
  148. }
  149. }
  150. if (self.delivery == 20) {
  151. let extract = {
  152. phone: _phone,
  153. linkman: _linkman,
  154. store_id: self.store_id
  155. }
  156. params.extract = JSON.stringify(extract)
  157. }
  158. self._post('plus.lottery.order/buy', params, function(res) {
  159. self.showSuccess('兑换成功', function(res) {
  160. uni.navigateBack()
  161. })
  162. });
  163. },
  164. /*获取数据*/
  165. getData() {
  166. let self = this;
  167. uni.showLoading({
  168. title: '加载中'
  169. })
  170. self.loadding = true;
  171. let params = {
  172. record_id: self.record_id,
  173. delivery_type: self.delivery,
  174. }
  175. if (self.delivery == 20) {
  176. params.store_id = self.store_id
  177. }
  178. self._get('plus.lottery.order/buy', params, function(res) {
  179. self.deliverySetting = res.data.data.deliverySetting;
  180. self.detail = res.data.data.product[0];
  181. self.extract_store = res.data.data.extract_store;
  182. self.exist_address = res.data.data.exist_address;
  183. self.Address = res.data.data.address;
  184. self.delivery = res.data.data.delivery_type;
  185. uni.hideLoading()
  186. self.loadding = false;
  187. }, function(res) {
  188. uni.navigateBack({
  189. delta: 1
  190. })
  191. });
  192. },
  193. hasType(e) {
  194. if (this.deliverySetting.indexOf(e) != -1) {
  195. return true;
  196. } else {
  197. return false;
  198. }
  199. },
  200. /*选择配送方式*/
  201. tabFunc(e) {
  202. this.tab_type = e;
  203. if (e == 0) {
  204. this.delivery = 10;
  205. } else {
  206. this.delivery = 20;
  207. }
  208. this.getData();
  209. },
  210. choosePaytype(payType) {
  211. this.payType = payType;
  212. },
  213. /*关闭弹窗*/
  214. closePopup(e, params) {
  215. this.isPopup = false;
  216. console.log(params)
  217. if (e && e.spec_attr) {
  218. this.detail['spec_name'] = '';
  219. let has = '已选:';
  220. let noone = '';
  221. e.spec_attr.forEach(item => {
  222. if (item.spec_items) {
  223. let h = '';
  224. for (let i = 0; i < item.spec_items.length; i++) {
  225. let child = item.spec_items[i];
  226. if (child.checked) {
  227. h = child.spec_value + ' / ';
  228. break;
  229. }
  230. }
  231. if (h != '') {
  232. has += h;
  233. } else {
  234. noone += item.group_name;
  235. }
  236. }
  237. })
  238. this.product_sku_id = params.product_sku_id;
  239. if (noone != '') {
  240. this.detail.spec_name = noone;
  241. } else {
  242. has = has.replace(/(\s\/\s)$/gi, '');
  243. this.detail.spec_name = has;
  244. }
  245. }
  246. },
  247. /* 打开弹窗 */
  248. openPopup(e, spe, detail) {
  249. let obj = {
  250. specData: spe,
  251. detail: detail,
  252. productSpecArr: spe != null ? new Array(spe.spec_attr.length) : [],
  253. show_sku: {
  254. sku_image: '',
  255. seckill_price: 0,
  256. product_sku_id: 0,
  257. line_price: 0,
  258. seckill_stock: 0,
  259. seckill_product_sku_id: 0,
  260. sum: 1
  261. },
  262. type: e
  263. };
  264. this.productModel = obj;
  265. this.isPopup = true;
  266. },
  267. }
  268. }
  269. </script>
  270. <style>
  271. page {
  272. background-color: #f2f2f2;
  273. }
  274. /*top-tab*/
  275. .top-tabbar {
  276. height: 90rpx;
  277. line-height: 86rpx;
  278. display: flex;
  279. justify-content: space-between;
  280. align-items: center;
  281. background: #FFFFFF;
  282. border-bottom: 1px solid #DDDDDD;
  283. }
  284. .tab-item {
  285. flex: 1;
  286. height: 90rpx;
  287. display: flex;
  288. justify-content: center;
  289. align-items: center;
  290. font-size: 28rpx;
  291. color: #666666;
  292. }
  293. /* */
  294. .gift-package {
  295. position: relative;
  296. min-height: 100vh;
  297. padding-bottom: 100rpx;
  298. }
  299. .gift-package .gift-package-main {
  300. width: 750rpx;
  301. background: #FFFFFF;
  302. padding: 30rpx;
  303. box-sizing: border-box;
  304. }
  305. .order_tit {
  306. padding-left: 30rpx;
  307. font-size: 28rpx;
  308. margin-bottom: 73rpx;
  309. }
  310. .gift-package-main .giftpackagr-info {
  311. margin: 0 auto;
  312. width: 350rpx;
  313. height: 43rpx;
  314. line-height: 43rpx;
  315. border: 1rpx solid #fa212c;
  316. margin-top: 18rpx;
  317. background: rgba(255, 255, 255, .8);
  318. border-radius: 30rpx;
  319. text-align: center;
  320. }
  321. .gift-package-main .giftpackagr-info .detatime {
  322. /* padding:10px 30px; */
  323. font-size: 18rpx;
  324. color: #fa1f29;
  325. font-weight: 800;
  326. }
  327. .cuopon-group {
  328. color: #ffffff;
  329. text-align: center;
  330. font-size: 30rpx;
  331. background-color: #ffffff30;
  332. border-radius: 15rpx;
  333. padding: 35rpx 0;
  334. }
  335. .cuopon-title {
  336. color: #919191;
  337. font-size: 35rpx;
  338. margin-bottom: 20rpx;
  339. }
  340. .cuopon-group .title {
  341. font-size: 24rpx;
  342. color: #cacaca;
  343. text-align: left;
  344. }
  345. .cuopon-group .body {}
  346. .cuopon_item {
  347. position: relative;
  348. }
  349. .item_cuopon {
  350. z-index: 50;
  351. }
  352. .cuopon-group .body .item {
  353. padding: 20rpx;
  354. display: flex;
  355. flex-direction: column;
  356. border-radius: 20rpx;
  357. position: relative;
  358. }
  359. .cuopon_img {
  360. width: 493rpx;
  361. height: 123rpx;
  362. position: absolute;
  363. top: 0;
  364. left: 0;
  365. }
  366. .cuopon-group .body .item .price {
  367. z-index: 50;
  368. font-size: 18rpx;
  369. margin-left: 26rpx;
  370. }
  371. .cuopon-group .body .item .des {
  372. z-index: 50;
  373. padding: 26rpx 0;
  374. font-size: 24rpx;
  375. text-align: left;
  376. margin-left: 50rpx;
  377. }
  378. .item .des .des_t {
  379. font-size: 26rpx;
  380. color: #000000;
  381. margin-bottom: 12rpx;
  382. }
  383. .item .des .des_c {
  384. font-size: 18rpx;
  385. color: #6b6b6b;
  386. margin-bottom: 8rpx;
  387. }
  388. .item .des .des_b {
  389. font-size: 18rpx;
  390. color: #6b6b6b;
  391. }
  392. .t-c {
  393. text-align: center;
  394. }
  395. .gift-package-main .integral {
  396. background-color: #ffffff66;
  397. padding-bottom: 60rpx;
  398. border-radius: 15rpx;
  399. }
  400. .gift-package-main .integral .title {
  401. font-size: 24rpx;
  402. color: #cacaca;
  403. text-align: left;
  404. }
  405. .gift-package-main .integral_btom {
  406. border: 1rpx solid #cacaca;
  407. height: 193rpx;
  408. background-color: #ffffff;
  409. margin-top: 20rpx;
  410. border-radius: 15rpx;
  411. }
  412. .gift-package-main .integral .info {
  413. margin-left: 30rpx;
  414. width: 300rpx;
  415. color: #f0510e;
  416. }
  417. .gift-package-main .integral image {
  418. width: 135rpx;
  419. height: 135rpx;
  420. margin-left: 40rpx;
  421. }
  422. .gift-package-main .integral .num {
  423. font-size: 50rpx;
  424. }
  425. .btns {
  426. width: 100%;
  427. height: 100rpx;
  428. display: flex;
  429. justify-content: flex-end;
  430. align-items: center;
  431. position: fixed;
  432. bottom: 0;
  433. background-color: #FFFFFF;
  434. border-top: 1rpx solid #EEEEEE;
  435. z-index: 99;
  436. }
  437. .order_price {
  438. text-align: right;
  439. color: #fd0000;
  440. font-size: 30rpx;
  441. margin-left: 30rpx;
  442. }
  443. .btns button {
  444. width: 266rpx;
  445. height: 70rpx;
  446. background-color: #ee1413;
  447. color: #FFFFFF;
  448. text-align: center;
  449. line-height: 70rpx;
  450. border-radius: 35rpx;
  451. }
  452. .rule {
  453. overflow: hidden;
  454. position: absolute;
  455. right: 0;
  456. top: 480rpx;
  457. z-index: 100;
  458. }
  459. .rule_btn {
  460. margin-top: 27rpx;
  461. width: 183rpx;
  462. height: 62rpx;
  463. line-height: 62rpx;
  464. text-align: center;
  465. background-color: #e83514;
  466. border: 1rpx solid #ffffff;
  467. border-top-left-radius: 32rpx;
  468. border-bottom-left-radius: 32rpx;
  469. color: #ffffff;
  470. font-size: 26rpx;
  471. }
  472. .add {
  473. font-size: 73rpx;
  474. font-weight: 900;
  475. text-align: center;
  476. color: #FFFFFF;
  477. }
  478. .cuopon_num {
  479. display: inline-block;
  480. width: 40rpx;
  481. height: 40rpx;
  482. border: 1rpx solid #939393;
  483. margin-left: 150rpx;
  484. text-align: center;
  485. line-height: 40rpx;
  486. font-size: 18rpx;
  487. border-radius: 10rpx;
  488. position: absolute;
  489. top: 40px;
  490. right: 15px;
  491. color: #000000;
  492. }
  493. .product_img {
  494. width: 140rpx;
  495. height: 140rpx;
  496. }
  497. .pro {
  498. margin-left: 12rpx;
  499. text-align: left;
  500. flex: 1;
  501. }
  502. .pro_t {
  503. font-size: 24rpx;
  504. color: #000000;
  505. margin-bottom: 15rpx;
  506. }
  507. .pro_c {
  508. font-size: 20rpx;
  509. color: #686868;
  510. }
  511. .pro_b {
  512. font-size: 28rpx;
  513. color: #fd0000;
  514. }
  515. .f18 {
  516. font-size: 18rpx;
  517. }
  518. .pro_choose {
  519. width: 33rpx;
  520. height: 33rpx;
  521. position: absolute;
  522. right: 10rpx;
  523. top: 6rpx;
  524. }
  525. .borbox {
  526. border: 1rpx solid #cacaca;
  527. }
  528. .type_activ {
  529. width: 40rpx;
  530. height: 40rpx;
  531. background-color: #04BE01;
  532. border-radius: 50%;
  533. overflow: hidden;
  534. text-align: center;
  535. line-height: 1;
  536. }
  537. .icon-tijiaochenggong {
  538. color: #FFFFFF;
  539. font-size: 22rpx;
  540. }
  541. .speci {
  542. font-size: 24rpx;
  543. width: 100rpx;
  544. height: 44rpx;
  545. color: #FFFFFF;
  546. text-align: center;
  547. border-radius: 22rpx;
  548. background-color: #fd0000;
  549. line-height: 44rpx;
  550. }
  551. .pro_not {
  552. width: 33rpx;
  553. height: 33rpx;
  554. position: absolute;
  555. right: 10rpx;
  556. top: 6rpx;
  557. border: 1rpx solid #CACACA;
  558. border-radius: 50%;
  559. }
  560. </style>