createOrder.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. <template>
  2. <view :class="[AppTheme]">
  3. <view v-if="!ifpeon">
  4. <u-empty margin-top="60" text="您还未进行实名认证" mode="order"></u-empty>
  5. <view class="goreins" @click="gopenre()">点击去实名认证</view>
  6. </view>
  7. <view v-if="ifpeon">
  8. <u-loading-icon :show="login" mode="semicircle" size="30" class="loading"></u-loading-icon>
  9. <view v-if="!login">
  10. <navigator url="/pagesD/pages/address/address?source=1" class="address-section" v-if="flag">
  11. <view class="order-content">
  12. <view class="cen" v-if="addressData">
  13. <view class="top" style="display: flex;justify-content: left;padding: 5rpx;">
  14. <u-icon name="phone" color="#2979ff" labelSize="16" labelColor="#191919"
  15. :label="(addressData.name||'')+' '+(addressData.mobile||'')" size="20"></u-icon>
  16. </view>
  17. <view style="display: flex;justify-content: left;padding: 5rpx;">
  18. <u-icon name="map" color="#2979ff" labelSize="12" labelColor="#a7a7a7"
  19. :label="(addressData.address||'')+(addressData.area||'')" size="20"></u-icon>
  20. </view>
  21. </view>
  22. <view class="cen" v-else>
  23. <view class="top">请选择收货地址...</view>
  24. </view>
  25. <text class="yticon icon-you"></text>
  26. </view>
  27. <image class="a-bg"
  28. src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAAFCAYAAAAaAWmiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJod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ITSI0kUa1IvF7JcribPbxZnt9BYIeBZm0ap1BO2yHLMOIxjH111chmDocXg9XzZFR4fD74e5cA9GtQEulbLGbfaNMvv4+BfG3hiet9wxlUeDGdDPn68uqXVgVKKezbiBN/HHYoTnrqlORkDx0BHr/ABzVVbknbZysZ3wnRVyda6HU1UIjvpt28p2C+T+GEtYeeEh3jqcdKjl2BcWY65q9UAQb+c6+k3iePnaS+P5Pq8spOJ38fJ09RVI1OFuWo6xtJXSD+J6xh++OHN8PEt8HxtNY4pbAczC+m2Rnh8V3J9Q0Fa4LeG97YQdehj4aoSL9NZiZNMTKStp6g5/x5NsW37vWQaS1WXzPHvjihzYS/lgshbeJ75WySHm7wNXXk8SbK/xutOX4ntHtYRxE0eJn6uARaGf6ie++7GPNxVkf/78AAwCn1+RYqusbZQAAAABJRU5ErkJggg==">
  29. </image>
  30. </navigator>
  31. <!-- 自提点-->
  32. <view class="ziti" v-if="!flag">
  33. <view class="ziti_city">
  34. <view class="not-arrow" @click="show_0 = true">
  35. <span>{{ city[0].name || '省份' }}</span>
  36. <u-picker :show="show_0" :columns="province" @confirm="get_city" keyName="name"></u-picker>
  37. </view>
  38. <view class="not-arrow" @click="show_1 = true">
  39. <span>{{ city[1].name || '城市' }}</span>
  40. <u-picker :show="show_1" :columns="province_area" @confirm="get_area" keyName="name">
  41. </u-picker>
  42. </view>
  43. <view class="not-arrow" @click="show_2 = true">
  44. <span>{{ city[2].name || '地区' }}</span>
  45. <u-picker :show="show_2" :columns="province_twon" @confirm="get_twon" keyName="name">
  46. </u-picker>
  47. </view>
  48. </view>
  49. <view class="search_pickup" @click="search_pickup">自提点查询</view>
  50. <view class="since"></view>
  51. <view v-html="demoHtml" style="list-style: none;padding: 20rpx;"></view>
  52. </view>
  53. <view class="goods-section">
  54. <!-- 商品列表 -->
  55. <view class="g-item" v-for="(item, index) in orderList.result.goodslist" :key="index">
  56. <image :src=" item.pic"></image>
  57. <view class="right">
  58. <u--text lines="2" lineHeight="20" :text="item.name"></u--text>
  59. <u--text color="$font-color-light" size="13" lineHeight="20" :text="item.skuattr"></u--text>
  60. <view class="price-box">
  61. <view class="price">¥{{ item.price }}</view>
  62. <!-- 有疑问-->
  63. <view class="number">x {{ item.num }}</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 优惠明细 -->
  69. <view class="yt-list">
  70. <view class="yt-list-cell b-b" @click="toggleMask('show')">
  71. <view class="cell-icon">券</view>
  72. <text class="cell-tit clamp">优惠券</text>
  73. <text class="cell-tip active">{{ clamp }}</text>
  74. <text class="cell-more wanjia wanjia-gengduo-d"></text>
  75. </view>
  76. <view class="yt-list-cell b-b">
  77. <view class="cell-icon hb">减</view>
  78. <text class="cell-tit clamp">商家促销</text>
  79. <text class="cell-tip disabled">商家暂无促销</text>
  80. </view>
  81. </view>
  82. <!-- 金额明细 -->
  83. <view class="yt-list">
  84. <view class="yt-list-cell b-b">
  85. <text class="cell-tit clamp">商品金额</text>
  86. <text class="cell-tip">¥{{ orderList.totalprice }}</text>
  87. </view>
  88. <view class="yt-list-cell b-b">
  89. <text class="cell-tit clamp">会员折扣</text>
  90. <text class="cell-tip text-neutral">-¥{{ orderList.vipzkmoney }}</text>
  91. </view>
  92. <view class="yt-list-cell b-b">
  93. <text class="cell-tit clamp">总优惠金额</text>
  94. <text class="cell-tip text-neutral">-¥{{ preferential+orderList.vipzkmoney }}</text>
  95. </view>
  96. <view class="yt-list-cell b-b">
  97. <text class="cell-tit clamp">运费</text>
  98. <text class="cell-tip">{{ '¥' + orderList.yf || '免运费' }}</text>
  99. </view>
  100. <view class="yt-list-cell desc-cell">
  101. <text class="cell-tit clamp">备注</text>
  102. <input class="desc" type="text" v-model="desc" placeholder="请填写备注信息"
  103. placeholder-class="placeholder" />
  104. </view>
  105. </view>
  106. <!-- 底部 -->
  107. <view class="footer">
  108. <view class="price-content">
  109. <text>实付款</text>
  110. <text class="price-tip text-neutral">¥</text>
  111. <text class="price text-neutral">{{ orderList.payprice }}</text>
  112. </view>
  113. <text class="submit bg-linear-gradient" @click="submit">提交订单</text>
  114. </view>
  115. <!-- 优惠券面板 -->
  116. <yhcoupon ref="yh_coupon" :orderList="orderList" :showModal="showPay" @close="onclose"></yhcoupon>
  117. </view>
  118. </view>
  119. <payment ref="payment" :channel="1" :alipay="true" :weixinpay="true" :zhtpay="true"></payment>
  120. </view>
  121. </template>
  122. <script>
  123. import api from '@/api/mall/index.js';
  124. import cart from '@/api/cart/index.js';
  125. import api_address from '@/api/address/address.js';
  126. import yhcoupon from '@/components/nx-coupon/yh_coupon.vue';
  127. export default {
  128. components: {
  129. yhcoupon
  130. },
  131. data() {
  132. return {
  133. primary: this.$theme.primary,
  134. maskState: 0, //优惠券面板显示状态
  135. desc: '', //备注
  136. payType: 1, //1微信 2支付宝
  137. province: [],
  138. clone: '',
  139. login: true,
  140. province_area: [],
  141. province_twon: [],
  142. city: [{
  143. s: '0',
  144. name: ''
  145. },
  146. {
  147. b: '0',
  148. name: ''
  149. },
  150. {
  151. m: '0',
  152. name: ''
  153. }
  154. ],
  155. ifpeon: true,
  156. show_0: false,
  157. show_1: false,
  158. show_2: false,
  159. orderList: '',
  160. addressData: '',
  161. num: 1,
  162. isact: '',
  163. settingFile: getApp().globalData.siteinfo,
  164. flag: true,
  165. demoHtml: '',
  166. preferential: 0,
  167. clamp: '暂无优惠券',
  168. djqid: 0,
  169. goodids: '',
  170. ftype: '',
  171. payparams: {
  172. },
  173. showPay: false,
  174. opayprice: 0
  175. };
  176. },
  177. onLoad(option) {
  178. option.ftype ? this.ftype = option.ftype : this.ftype = ""
  179. option.isact ? this.isact = option.isact : this.isact = ""
  180. option.goodsid ? this.goodids = option.goodsid : this.goodids = ""
  181. this.getAddressData(option);
  182. },
  183. computed: {
  184. sum() {
  185. return this.orderList.score * this.num;
  186. },
  187. actual() {
  188. return this.orderList.score * this.num - 35;
  189. }
  190. },
  191. methods: {
  192. onclose(item) {
  193. console.log('item', JSON.stringify(item));
  194. this.showPay = item.show;
  195. if (item.money == -2) {
  196. this.orderList.payprice = this.opayprice;
  197. this.preferential = 0;
  198. this.clamp = '暂不使用优惠券'
  199. } else if (item.money > 0) {
  200. this.clamp = -item.money
  201. this.preferential = item.money;
  202. this.orderList.payprice = this.opayprice - item.money;
  203. this.djqid = item.djqid;
  204. this.clone.payprice = this.orderList.payprice
  205. }
  206. },
  207. gopenre() {
  208. uni.redirectTo({
  209. url: '/pagesD/pages/set/renzheng/renzheng'
  210. });
  211. },
  212. orderMake() {
  213. let that = this;
  214. /* 判断pay页面 支付方式 */
  215. let delivery = that.flag == true ? 'express' : 'since';
  216. const userInfo = uni.getStorageSync('userInfo');
  217. /* 参数 */
  218. var obj = {
  219. sid: 0,
  220. goodstype: that.orderList.cache[0].goodstype,
  221. vipid: that.addressData.vipid,
  222. vipopenid: userInfo.openid,
  223. vipname: encodeURI(that.addressData.name),
  224. vipaddress: encodeURI(that.addressData.address),
  225. vipmobile: that.addressData.mobile,
  226. totalnum: that.clone.totalnum, // 克隆出的参数
  227. totalprice: that.clone.totalprice, // 克隆出的参数
  228. djqid: that.djqid,
  229. isact: that.isact,
  230. groupid: that.$store.state.groupid,
  231. delivery,
  232. goodids: that.goodids,
  233. address: that.orderList.vip.id,
  234. sinceid: 0,
  235. bid: that.orderList.bid,
  236. items: encodeURI(that.orderList.allitems),
  237. province: that.city[0].s,
  238. city: that.city[1].b,
  239. district: that.city[2].m,
  240. msg: encodeURI(that.desc),
  241. };
  242. if (that.ftype) {
  243. obj.ftype = that.ftype
  244. }
  245. /* 生成订单 */
  246. api.shop_orderMake_post(obj).then(res => {
  247. console.log('shop_orderMake_post', res)
  248. if (res.status == 200) {
  249. that.$refs.payment.payopen({
  250. orderid: res.data.orderid,
  251. djqid: that.djqid,
  252. money: that.clone.payprice
  253. });
  254. } else {
  255. uni.showToast({
  256. title: res.msg,
  257. icon: "none"
  258. });
  259. }
  260. });
  261. },
  262. get_city(e) {
  263. this.city[0].s = e[0].value;
  264. this.city[0].name = e[0].label;
  265. let parent_id = this.city[0].s;
  266. if (parent_id == 0) {
  267. return;
  268. }
  269. api.getRegion({
  270. level: 2,
  271. parent_id: parent_id
  272. }).then(res => {
  273. if (res.status == 200) {
  274. this.province_area = res.data;
  275. this.city[1].b = 0;
  276. this.city[1].name = '';
  277. this.city[2].m = 0;
  278. this.city[2].name = '';
  279. } else {
  280. this.$api.msg('获取失败');
  281. }
  282. });
  283. },
  284. get_area(e) {
  285. this.city[1].b = e[0].value;
  286. this.city[1].name = e[0].label;
  287. //选择域
  288. let parent_id = this.city[1].b;
  289. if (parent_id == 0) {
  290. return;
  291. }
  292. api.getTwon({
  293. level: 3,
  294. parent_id: parent_id
  295. }).then(res => {
  296. if (res.status == 200) {
  297. this.province_twon = res.data;
  298. this.city[2].m = 0;
  299. this.city[2].name = '';
  300. } else {
  301. this.$api.msg('获取失败');
  302. }
  303. });
  304. },
  305. get_twon(e) {
  306. this.city[2].m = e[0].value;
  307. this.city[2].name = e[0].label;
  308. },
  309. search_pickup() {
  310. if (this.province.length == 0) {
  311. this.$api.msg('请选择省份!');
  312. return;
  313. }
  314. let that = this;
  315. /*#ifdef MP */
  316. uni.showToast({
  317. title: '加载自提点中...'
  318. });
  319. uni.authorize({
  320. scope: 'scope.userLocation',
  321. success() {
  322. uni.getLocation({
  323. type: 'gcj02',
  324. success: function(res) {
  325. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  326. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  327. var speed = res.speed; // 速度,以米/每秒计
  328. var accuracy = res.accuracy; // 位置精度
  329. var pickups = that.orderList.pickups;
  330. console.log(pickups);
  331. if (pickups != '') {
  332. let obj = {
  333. latitude,
  334. longitude,
  335. province: that.city[0].s,
  336. city: that.city[1].b,
  337. district: that.city[2].m,
  338. pickups
  339. };
  340. cart.pickup(obj).then(data => {
  341. if (data.status == 200) {
  342. if (data.data.info) {
  343. that.demoHtml = data.data.info;
  344. uni.hideLoading();
  345. }
  346. } else {
  347. that.$api.msg('获取失败');
  348. uni.hideLoading();
  349. }
  350. });
  351. }
  352. }
  353. });
  354. }
  355. });
  356. /* #endif*/
  357. },
  358. /* 优惠券*/
  359. mask(e, flag) {
  360. console.log(e);
  361. /* 还原*/
  362. this.orderList.payprice = this.clone.payprice;
  363. this.preferential = 0; // 优惠金额
  364. this.clamp = '选择优惠券';
  365. /* 还原*/
  366. if (flag) {
  367. this.djqid = 0;
  368. this.toggleMask(0);
  369. return;
  370. }
  371. let totalprice = this.orderList.totalprice; // 商品金额
  372. if (totalprice < e.usemoney) {
  373. this.$refs.uTips.show({
  374. title: '价格不足 无法使用!',
  375. type: 'error',
  376. duration: '2300'
  377. });
  378. return;
  379. }
  380. this.djqid = e.id; // 代金券id
  381. this.orderList.payprice > e.money ? (this.orderList.payprice -= e.money) : (this.orderList.payprice =
  382. 0); // 价格
  383. this.preferential = e.money; // 优惠金额
  384. this.clamp = '满' + e.usemoney + '减' + e.money;
  385. this.toggleMask(0);
  386. },
  387. //显示优惠券面板
  388. toggleMask(type) {
  389. if (this.orderList.djq.length > 0) {
  390. this.showPay = true
  391. }
  392. let timer = type === 'show' ? 10 : 300;
  393. let state = type === 'show' ? 1 : 0;
  394. this.maskState = 2;
  395. setTimeout(() => {
  396. this.maskState = state;
  397. }, timer);
  398. },
  399. /* 获取订单信息*/
  400. orderIndex(option) {
  401. api.shop_orderMake(option).then(res => {
  402. if (res.status == 200) {
  403. this.orderList = res.data;
  404. this.opayprice = this.orderList.payprice
  405. this.clone = this.$u.deepClone(res.data);
  406. this.province = res.data.province;
  407. this.login = false;
  408. } else if (res.status == 402) {
  409. this.$api.msg(res.msg);
  410. this.ifpeon = false
  411. } else {
  412. this.$api.msg(res.msg);
  413. this.login = false;
  414. }
  415. });
  416. },
  417. getAddressData(option) {
  418. api_address.address().then(res => {
  419. console.log(res, "address");
  420. if (res.status == 200) {
  421. if (res.data) {
  422. let is_default = res.data.data.filter(item => item.is_default == 1);
  423. this.addressData = is_default[0];
  424. }
  425. this.orderIndex(option);
  426. } else {
  427. this.$api.msg(res.msg);
  428. }
  429. });
  430. },
  431. numberChange(data) {
  432. this.number = data.number;
  433. },
  434. changePayType(type) {
  435. this.payType = type;
  436. },
  437. submit() {
  438. let that = this
  439. if (!that.addressData && that.flag) {
  440. that.$api.msg('请选择收货地址!');
  441. return;
  442. }
  443. let tmplIdsone = that.$config.temlist;
  444. if (tmplIdsone) {
  445. that.$until.requestSubscribeMessage([tmplIdsone['orderSuccess'], tmplIdsone['orderDelivery']],
  446. tmplIdsone,
  447. function() {
  448. that.orderMake();
  449. });
  450. }else{
  451. that.orderMake();
  452. }
  453. },
  454. stopPrevent() {}
  455. }
  456. };
  457. </script>
  458. <style lang="scss">
  459. * {
  460. list-style: none;
  461. }
  462. .goreins {
  463. margin-top: 30upx;
  464. display: flex;
  465. align-items: center;
  466. justify-content: center;
  467. width: 600upx;
  468. height: 80upx;
  469. font-size: $font-lg;
  470. color: #fff;
  471. background: $tab-color;
  472. border-radius: 10upx;
  473. margin: 25rpx auto 0 auto;
  474. &.hollow {
  475. background: #fff;
  476. color: #303133;
  477. border: 1px solid #ccc;
  478. }
  479. }
  480. .loading {
  481. position: absolute;
  482. left: 48%;
  483. top: 50%;
  484. }
  485. .tag {
  486. width: 100%;
  487. height: 106rpx;
  488. background-color: #fff;
  489. display: flex;
  490. margin-top: 10rpx;
  491. margin-bottom: 10rpx;
  492. .tag_box {
  493. flex: 1;
  494. text-align: center;
  495. line-height: 106rpx;
  496. font-size: 24rpx;
  497. border-bottom: 1rpx solid #999999;
  498. }
  499. }
  500. .tag_active {
  501. border-bottom: 1rpx solid $tab-color-2 !important;
  502. }
  503. .ziti {
  504. width: 100%;
  505. padding: 56rpx 28rpx;
  506. box-sizing: border-box;
  507. .ziti_city {
  508. display: flex;
  509. justify-content: space-around;
  510. select {
  511. border: 1px solid #dad8cd;
  512. min-width: 180rpx;
  513. }
  514. }
  515. .search_pickup {
  516. color: red;
  517. width: 250rpx;
  518. height: 56rpx;
  519. text-align: center;
  520. line-height: 56rpx;
  521. color: #04be02;
  522. border: 1px solid #04be02;
  523. border-radius: 10rpx;
  524. margin: 50rpx auto 0;
  525. }
  526. .since {
  527. width: 90%;
  528. border-top: 1rpx dashed #999999;
  529. margin: 30rpx auto 0;
  530. }
  531. .not-arrow {
  532. width: 200rpx;
  533. height: 54rpx;
  534. padding: 5px 10px;
  535. border: 1px solid #dcd8d8;
  536. box-sizing: border-box;
  537. display: flex;
  538. align-items: center;
  539. }
  540. }
  541. .address-section {
  542. padding: 10rpx 10rpx 15rpx 10rpx;
  543. background: #fff;
  544. position: relative;
  545. .order-content {
  546. display: flex;
  547. align-items: center;
  548. }
  549. .icon-shouhuodizhi {
  550. flex-shrink: 0;
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. width: 90upx;
  555. color: #888;
  556. font-size: 44upx;
  557. }
  558. .cen {
  559. display: flex;
  560. flex-direction: column;
  561. flex: 1;
  562. font-size: 28upx;
  563. color: $font-color-dark;
  564. }
  565. .name {
  566. font-size: 34upx;
  567. margin-right: 24upx;
  568. }
  569. .address {
  570. margin-top: 16upx;
  571. margin-right: 20upx;
  572. color: $font-color-light;
  573. }
  574. .icon-you {
  575. font-size: 32upx;
  576. color: $font-color-light;
  577. margin-right: 30upx;
  578. }
  579. .a-bg {
  580. position: absolute;
  581. left: 0;
  582. bottom: 0;
  583. display: block;
  584. width: 100%;
  585. height: 5upx;
  586. }
  587. }
  588. .goods-section {
  589. margin-top: 16upx;
  590. background: #fff;
  591. padding-bottom: 1px;
  592. padding-top: 10rpx;
  593. .g-header {
  594. display: flex;
  595. align-items: center;
  596. height: 84upx;
  597. padding: 0 30upx;
  598. position: relative;
  599. }
  600. .logo {
  601. display: block;
  602. width: 50upx;
  603. height: 50upx;
  604. border-radius: 100px;
  605. }
  606. .name {
  607. font-size: 30upx;
  608. color: $font-color-base;
  609. margin-left: 24upx;
  610. }
  611. .g-item {
  612. display: flex;
  613. margin: 20upx 30upx;
  614. image {
  615. flex-shrink: 0;
  616. display: block;
  617. width: 140upx;
  618. height: 140upx;
  619. border-radius: 8upx;
  620. }
  621. .right {
  622. flex: 1;
  623. padding-left: 24upx;
  624. overflow: hidden;
  625. .title {
  626. font-size: 30upx;
  627. color: $font-color-dark;
  628. height: 40rpx;
  629. line-height: 40rpx;
  630. }
  631. .spec {
  632. margin-top: 40rpx;
  633. font-size: 26upx;
  634. color: $font-color-light;
  635. }
  636. .price-box {
  637. display: flex;
  638. align-items: center;
  639. font-size: 32upx;
  640. color: $font-color-dark;
  641. padding-top: 20rpx;
  642. .price {
  643. margin-bottom: 4upx;
  644. }
  645. .number {
  646. font-size: 26upx;
  647. color: $font-color-base;
  648. margin-left: 20upx;
  649. }
  650. }
  651. }
  652. .step-box {
  653. position: relative;
  654. }
  655. }
  656. }
  657. .yt-list {
  658. margin-top: 16upx;
  659. background: #fff;
  660. }
  661. .yt-list-cell {
  662. display: flex;
  663. align-items: center;
  664. padding: 10upx 30upx 10upx 40upx;
  665. line-height: 70upx;
  666. position: relative;
  667. &.cell-hover {
  668. background: #fafafa;
  669. }
  670. &.b-b:after {
  671. left: 30upx;
  672. }
  673. .cell-icon {
  674. height: 32upx;
  675. width: 32upx;
  676. font-size: 22upx;
  677. color: #fff;
  678. text-align: center;
  679. line-height: 32upx;
  680. background: #f85e52;
  681. border-radius: 4upx;
  682. margin-right: 12upx;
  683. &.hb {
  684. background: #ffaa0e;
  685. }
  686. &.lpk {
  687. background: #3ab54a;
  688. }
  689. }
  690. .cell-more {
  691. align-self: center;
  692. font-size: 24upx;
  693. color: $font-color-light;
  694. margin-left: 8upx;
  695. margin-right: -10upx;
  696. }
  697. .cell-tit {
  698. flex: 1;
  699. font-size: 26upx;
  700. color: $font-color-light;
  701. margin-right: 10upx;
  702. }
  703. .cell-tip {
  704. font-size: 26upx;
  705. &.disabled {
  706. color: $font-color-light;
  707. }
  708. &.active {
  709. color: $base-color;
  710. }
  711. }
  712. &.desc-cell {
  713. .cell-tit {
  714. max-width: 90upx;
  715. }
  716. }
  717. .desc {
  718. flex: 1;
  719. font-size: $font-base;
  720. color: $font-color-dark;
  721. }
  722. }
  723. /* 支付列表 */
  724. .pay-list {
  725. padding-left: 40upx;
  726. margin-top: 16upx;
  727. background: #fff;
  728. .pay-item {
  729. display: flex;
  730. align-items: center;
  731. padding-right: 20upx;
  732. line-height: 1;
  733. height: 110upx;
  734. position: relative;
  735. }
  736. .icon-weixinzhifu {
  737. width: 80upx;
  738. font-size: 40upx;
  739. color: #6bcc03;
  740. }
  741. .icon-alipay {
  742. width: 80upx;
  743. font-size: 40upx;
  744. color: #06b4fd;
  745. }
  746. .icon-xuanzhong2 {
  747. display: flex;
  748. align-items: center;
  749. justify-content: center;
  750. width: 60upx;
  751. height: 60upx;
  752. font-size: 40upx;
  753. color: $base-color;
  754. }
  755. .tit {
  756. font-size: 32upx;
  757. color: $font-color-dark;
  758. flex: 1;
  759. }
  760. }
  761. .footer {
  762. position: fixed;
  763. left: 0;
  764. bottom: 0;
  765. z-index: 995;
  766. display: flex;
  767. align-items: center;
  768. width: 100%;
  769. height: 90upx;
  770. justify-content: space-between;
  771. font-size: 30upx;
  772. background-color: #fff;
  773. z-index: 998;
  774. color: $font-color-base;
  775. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  776. .price-content {
  777. padding-left: 30upx;
  778. }
  779. .price-tip {
  780. margin-left: 8upx;
  781. }
  782. .price {
  783. font-size: 36upx;
  784. }
  785. .submit {
  786. display: flex;
  787. align-items: center;
  788. justify-content: center;
  789. width: 280upx;
  790. height: 100%;
  791. color: #fff;
  792. font-size: 32upx;
  793. }
  794. }
  795. /* 优惠券面板 */
  796. .mask {
  797. display: flex;
  798. align-items: flex-end;
  799. position: fixed;
  800. left: 0;
  801. top: var(--window-top);
  802. bottom: 0;
  803. width: 100%;
  804. background: rgba(0, 0, 0, 0);
  805. z-index: 9995;
  806. transition: 0.3s;
  807. .mask-content {
  808. width: 100%;
  809. min-height: 30vh;
  810. max-height: 70vh;
  811. background: #f3f3f3;
  812. transform: translateY(100%);
  813. transition: 0.3s;
  814. overflow-y: scroll;
  815. }
  816. &.none {
  817. display: none;
  818. }
  819. &.show {
  820. background: rgba(0, 0, 0, 0.4);
  821. .mask-content {
  822. transform: translateY(0);
  823. }
  824. }
  825. }
  826. /* 优惠券列表 */
  827. .coupon-item {
  828. display: flex;
  829. flex-direction: column;
  830. margin: 20upx 24upx;
  831. background: #fff;
  832. .con {
  833. display: flex;
  834. align-items: center;
  835. position: relative;
  836. height: 120upx;
  837. padding: 0 30upx;
  838. &:after {
  839. position: absolute;
  840. left: 0;
  841. bottom: 0;
  842. content: '';
  843. width: 100%;
  844. height: 0;
  845. border-bottom: 1px dashed #f3f3f3;
  846. transform: scaleY(50%);
  847. }
  848. }
  849. .left {
  850. display: flex;
  851. flex-direction: column;
  852. justify-content: center;
  853. flex: 1;
  854. overflow: hidden;
  855. height: 100upx;
  856. }
  857. .title {
  858. font-size: 32upx;
  859. color: $font-color-dark;
  860. margin-bottom: 20upx;
  861. }
  862. .time {
  863. font-size: 24upx;
  864. color: $font-color-light;
  865. }
  866. .right {
  867. display: flex;
  868. flex-direction: column;
  869. justify-content: center;
  870. align-items: center;
  871. font-size: 26upx;
  872. color: $font-color-base;
  873. height: 100upx;
  874. }
  875. .price {
  876. font-size: 44upx;
  877. color: $base-color;
  878. margin-bottom: 20rpx;
  879. &:before {
  880. content: '¥';
  881. font-size: 34upx;
  882. }
  883. }
  884. .tips {
  885. font-size: 24upx;
  886. color: $font-color-light;
  887. line-height: 60upx;
  888. padding-left: 30upx;
  889. }
  890. .circle {
  891. position: absolute;
  892. left: -6upx;
  893. bottom: -10upx;
  894. z-index: 10;
  895. width: 20upx;
  896. height: 20upx;
  897. background: #f3f3f3;
  898. border-radius: 100px;
  899. &.r {
  900. left: auto;
  901. right: -6upx;
  902. }
  903. }
  904. }
  905. </style>