createOrder.vue 25 KB

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