createOrder.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. <template>
  2. <view>
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  6. </view>
  7. <!-- 地址 -->
  8. <navigator v-if="tabCurrentIndex == 0" url="/pages/address/address?source=1" class="address-section">
  9. <view class="order-content" v-if="addressData.real_name">
  10. <text class="iconfont iconlocation"></text>
  11. <view class="cen">
  12. <view class="top">
  13. <text class="name">{{ addressData.real_name }}</text>
  14. <text class="mobile">{{ addressData.phone }}</text>
  15. </view>
  16. <text class="address">{{ addressData.province + addressData.city + addressData.district }}
  17. {{ addressData.detail }}</text>
  18. </view>
  19. <text class="iconfont iconenter"></text>
  20. </view>
  21. <view class="order-content" v-if="!addressData.real_name">
  22. <view class="addAddress">
  23. <text class="iconfont iconaddition"></text>
  24. <text>添加收货地址</text>
  25. </view>
  26. </view>
  27. <image class="a-bg" :src="addressImg"></image>
  28. </navigator>
  29. <navigator v-if="tabCurrentIndex == 1" url="/pages/shoping/list?type=4" class="address-section">
  30. <view class="order-content" v-if="shopAddress.name">
  31. <text class="iconfont iconlocation"></text>
  32. <view class="cen">
  33. <view class="top">
  34. <text class="name">{{ shopAddress.name }}</text>
  35. <text class="mobile">{{ shopAddress.phone }}</text>
  36. </view>
  37. <text class="address">{{ shopAddress.detailed_address }}</text>
  38. </view>
  39. <text class="iconfont iconenter"></text>
  40. </view>
  41. <view class="order-content" v-if="!shopAddress.name">
  42. <view class="addAddress">
  43. <text class="iconfont iconaddition"></text>
  44. <text>添加收货地址</text>
  45. </view>
  46. </view>
  47. <image class="a-bg" :src="addressImg"></image>
  48. </navigator>
  49. <view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
  50. <!-- <view class="g-header b-b">
  51. <image class="logo" :src="ls.productInfo.image"></image>
  52. <text class="name">{{ ls.name }}</text>
  53. </view> -->
  54. <!-- 商品列表 -->
  55. <view class="g-item">
  56. <image :src="ls.productInfo.image"></image>
  57. <view class="right">
  58. <text class="title clamp">{{ ls.productInfo.store_name }}</text>
  59. <text class="spec">{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.suk : '默认' }}</text>
  60. <view class="price-box">
  61. <text
  62. class="price">¥{{ moneyNum(ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price) }} </text>
  63. <text class="price" v-if="ls.productInfo.attrInfo.integral > 0 ">
  64. +{{ ls.productInfo.attrInfo.integral * 1 }}流动积分
  65. </text>
  66. <text class="number">{{ 'x ' + ls.cart_num + ls.productInfo.unit_name }}</text>
  67. <!-- <view><text class="price">¥{{lss.price}}</text></view> -->
  68. <!-- <view class="number">
  69. <uni-number-box class="step" :value="lss.number" :index="indx" @eventChange="numberChange"></uni-number-box>
  70. </view> -->
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 优惠明细 -->
  76. <!-- <view class="yt-list">
  77. <view class="yt-list-cell b-b" @click="toggleMask('show')">
  78. <view class="cell-icon">券</view>
  79. <text class="cell-tit clamp">优惠券</text>
  80. <text class="cell-tip active">选择优惠券</text>
  81. <text class="cell-more wanjia wanjia-gengduo-d"></text>
  82. </view>
  83. <view class="yt-list-cell b-b">
  84. <view class="cell-icon hb">减</view>
  85. <text class="cell-tit clamp">商家促销</text>
  86. <text class="cell-tip disabled">暂无可用优惠</text>
  87. </view>
  88. </view> -->
  89. <!-- 金额明细 -->
  90. <view class="yt-list">
  91. <!-- <view class="yt-list-cell b-b">
  92. <text class="cell-tit clamp">优惠金额</text>
  93. <text class="cell-tip red">-¥35</text>
  94. </view> -->
  95. <view class="yt-list-cell b-b">
  96. <text class="cell-tit clamp">流动积分抵扣{{ '(当前积分:' + integralAll + ')' }}</text>
  97. <view class="cell-tip"><radio @click="checkedPoints = !checkedPoints" color=" #5dbc7c" :checked="checkedPoints" /></view>
  98. </view>
  99. <view class="yt-list-cell b-b" v-if="inte_top > 0 && !checkedPoints && goodsType != 2">
  100. <text class="cell-tit clamp">抵用金{{ '(可用上限:' + inte_top + ')' }}</text>
  101. <view class="cell-tip">
  102. <radio @click="is_change = !is_change" color=" #5dbc7c" :checked="is_change" />
  103. </view>
  104. </view>
  105. <view class="yt-list-cell b-b">
  106. <text class="cell-tit clamp">运费</text>
  107. <text class="cell-tip">{{ Postage }}</text>
  108. </view>
  109. <view class="yt-list-cell desc-cell" v-if="tabCurrentIndex == 1">
  110. <text class="cell-tit clamp">姓名</text>
  111. <input class="desc" type="text" v-model="pickUpInfo.real_name" placeholder="收货人姓名"
  112. placeholder-class="placeholder" />
  113. </view>
  114. <view class="yt-list-cell desc-cell" v-if="tabCurrentIndex == 1">
  115. <text class="cell-tit clamp">手机</text>
  116. <input class="desc" type="text" v-model="pickUpInfo.phone" placeholder="联系手机号"
  117. placeholder-class="placeholder" />
  118. </view>
  119. <view class="yt-list-cell b-b">
  120. <text class="cell-tit clamp">备注</text>
  121. <input class="desc" type="text" v-model="desc" placeholder="备注信息" placeholder-class="placeholder" />
  122. </view>
  123. </view>
  124. <!-- <view class="yt-list" v-if="isRz==1">
  125. <view class="yt-list-cell b-b">
  126. <text class="cell-tit clamp">勾选确认入驻协议</text>
  127. <text class="cell-tip">
  128. <radio value="" color="#5dbc7c" @click="changeRz" :checked="isRz == checkedIsRz"></radio>
  129. </text>
  130. </view>
  131. </view> -->
  132. <view class="yt-list">
  133. <view class="yt-list-cell b-b">
  134. <text class="cell-tit clamp">商品总价</text>
  135. <text class="cell-tip" v-if="is_consumer == 0">¥{{ payAllMoney }}</text>
  136. <text class="cell-tip" v-if="is_consumer == 1">
  137. <!-- <image src="../../static/icon/xfq.png" mode="" class="cell-tip-1"></image> -->
  138. {{ payAllMoney }}
  139. </text>
  140. <!-- <text class="cell-tip">¥{{ payAllMoney }}</text> -->
  141. </view>
  142. <view class="yt-list-cell b-b" v-if="moneyAll.use_integral != ''">
  143. <text class="cell-tit clamp">流动积分</text>
  144. <text class="cell-tip">{{ moneyAll.use_integral }}</text>
  145. </view>
  146. <view class="yt-list-cell b-b" v-if="integralMoney > 0">
  147. <text class="cell-tit clamp">流动积分抵扣</text>
  148. <text class="cell-tip">-¥{{ integralMoney }}</text>
  149. </view>
  150. <view class="yt-list-cell b-b" v-if="!checkedPoints && moneyNum(moneyAll.vipPrice) > 0">
  151. <text class="cell-tit clamp">VIP优惠</text>
  152. <text class="cell-tip">-¥{{ moneyNum(moneyAll.vipPrice) }}</text>
  153. </view><strong></strong>
  154. </view>
  155. <!-- 底部 -->
  156. <view class="footer">
  157. <view class="price-content">
  158. <text>实付款</text>
  159. <text class="price-tip" v-if="is_consumer == 0">¥</text>
  160. <!-- <image src="../../static/icon/xfq.png" mode="" v-if="is_consumer == 1" class="price-top-1"></image> -->
  161. <text class="price">{{ payPrice }}</text>
  162. </view>
  163. <text class="submit" :class="{ submitNo: !payType }" @click="payType ? submit() : ''">提交订单</text>
  164. </view>
  165. <!-- 优惠券面板 -->
  166. <view class="mask" :class="maskState === 0 ? 'none' : maskState === 1 ? 'show' : ''" @click="toggleMask">
  167. <view class="mask-content" @click.stop.prevent="stopPrevent">
  168. <view class="coupon-item" @click="checkedCp(item)" v-for="(item, index) in couponList" :key="index">
  169. <view class="con">
  170. <view class="left">
  171. <text class="title">{{ item.coupon_title }}</text>
  172. <text class="time">领取时间{{ item.add_time }}</text>
  173. </view>
  174. <view class="right">
  175. <text class="price">{{ moneyNum(item.coupon_price) }}</text>
  176. <text>满{{ moneyNum(item.use_min_price) }}可用</text>
  177. </view>
  178. <view class="circle l"></view>
  179. <view class="circle r"></view>
  180. </view>
  181. <text class="tips">有效期至{{ item.end_time }}</text>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. </template>
  187. <script>
  188. import {
  189. confirm
  190. } from '@/api/order.js';
  191. import {
  192. computedOrderkey
  193. } from '@/api/money.js';
  194. import {
  195. userinfo
  196. } from '@/api/user.js';
  197. import {
  198. cartAdd
  199. } from '@/api/product.js';
  200. export default {
  201. data() {
  202. return {
  203. addressImg: 'data:image/png;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BBT7O6DRh/dhYOt20nqSdK+f1RIqdRMqRXgrR90Dm+Dfsdn2+QYpeH7/8CBe+mAsq7nIsevKEjivgv1dQdzYUGH7dMlXe3FmwxZMTRyFgiZkW48mF0/XMYWqm75JfH8IUmPA1tlUMnHv+8T3N3J8d3Hkey6I3re6Djvaam1v/urhswjdsQ2jf/kVJRI1xHdPrh1lltzTWUxXai5H07N74P7KettnPDQyjWtf/ohglyJfl7jz/drP+vDrzgYsLZdtP2PRnz6B/u4t9I+U9cYCH81hddoFuBG4bxNq7v9xSfh+G/H9wKkIwF5JkR38fF3VLb73dDXhpsYS8P0Vxve7MZ14E04EkX2SumDj40Lkjz2LS9x1nZVqcK1rh1L/GaiZDB1GYwGPRi9+sA4r63odGEjAoKTZS0mTwUtoS2sTPioc1jd64KJqNZXRP9EtLFrLT5KQOd6H1JtvQ/SUQ1CUC1Z/tjp5MgXn51bAfc1VpAUVb6pqi+bsqRlrOB0ITSI0kUa1IvF7JcribPbxZnt9BYIeBZm0ap1BO2yHLMOIxjH111chmDocXg9XzZFR4fD74e5cA9GtQEulbLGbfaNMvv4+BfG3hiet9wxlUeDGdDPn68uqXVgVKKezbiBN/HHYoTnrqlORkDx0BHr/ABzVVbknbZysZ3wnRVyda6HU1UIjvpt28p2C+T+GEtYeeEh3jqcdKjl2BcWY65q9UAQb+c6+k3iePnaS+P5Pq8spOJ38fJ09RVI1OFuWo6xtJXSD+J6xh++OHN8PEt8HxtNY4pbAczC+m2Rnh8V3J9Q0Fa4LeG97YQdehj4aoSL9NZiZNMTKStp6g5/x5NsW37vWQaS1WXzPHvjihzYS/lgshbeJ75WySHm7wNXXk8SbK/xutOX4ntHtYRxE0eJn6uARaGf6ie++7GPNxVkf/78AAwCn1+RYqusbZQAAAABJRU5ErkJggg==',
  204. // 当前选中的支付方式
  205. tabCurrentIndex: 0,
  206. navList: [{
  207. state: 0,
  208. text: '快递配送'
  209. },
  210. {
  211. state: 1,
  212. text: '到店自提'
  213. }
  214. ],
  215. maskState: 0, //优惠券面板显示状态
  216. desc: '', //备注
  217. payType: 1, //1微信 2支付宝
  218. // 优惠券列表
  219. couponList: [],
  220. // 收货地址
  221. addressData: {
  222. real_name: '',
  223. phone: ''
  224. },
  225. // 提货个人信息
  226. pickUpInfo: {
  227. real_name: '',
  228. phone: ''
  229. },
  230. // 店铺地址
  231. shopAddress: {
  232. name: '',
  233. mobile: '',
  234. addressName: '',
  235. address: '',
  236. area: '',
  237. default: false,
  238. id: ''
  239. },
  240. // 商品列表
  241. shopList: [],
  242. // 购物车id
  243. cartId: '',
  244. //购物金额详情
  245. moneyAll: {
  246. storeFreePostage: 0, //邮费优惠
  247. storePostage: 0, //邮费
  248. totalPrice: 0, //总支付金额
  249. vipPrice: 0, //vip优惠价
  250. use_integral: 0, //积分
  251. },
  252. payPrice: 0, //总支付金额
  253. orderKey: '', //订单id
  254. checkedPoints: false, //判断是否积分抵扣
  255. integralAll: 0, //可使用的积分
  256. integralMoney: 0, //积分抵扣金额
  257. integralShow: false, //是否显示积分抵扣金额
  258. payType: true, //是否可支付
  259. system_store: [], //到店自提列表仓库
  260. pinkid: '', //保存拼团商品id
  261. is_change: false, //判断是否全额抵扣0为否1为是
  262. inte_top: 0, //积分抵扣上限
  263. goodsType: 0, //0为普通商品2为拼团1为秒杀
  264. is_consumer: 0, //1为消费券商品
  265. isRz: 0,
  266. checkedIsRz: 0, //判断是否已经勾选
  267. };
  268. },
  269. onLoad(option) {
  270. this.goodsType = option.goodsType || 0;
  271. // 载入认证类型
  272. if (option.isRz) {
  273. this.isRz = +option.isRz;
  274. }
  275. // 判断是否为拼团商品
  276. if (option.consumer) {
  277. this.is_consumer = option.consumer
  278. }
  279. if (option.type == 'pink') {
  280. this.pinkid = option.pinkId;
  281. this.goodsType = 2;
  282. this.cartAdd(option);
  283. } else {
  284. // 保存当前商品在购物车中的id
  285. this.cartId = option.id;
  286. this.loadData();
  287. }
  288. this.userinfo();
  289. },
  290. watch: {
  291. checkedPoints(newValue, oldValue) {
  292. this.integralShow = false;
  293. this.payMoneyNub();
  294. },
  295. //门店切换
  296. tabCurrentIndex(newValue) {
  297. this.payMoneyNub();
  298. },
  299. // 监听是否全额抵扣
  300. is_change() {
  301. this.integralShow = false;
  302. this.payMoneyNub();
  303. },
  304. // 监听收货地址改变
  305. addressData() {
  306. this.payMoneyNub();
  307. }
  308. },
  309. computed: {
  310. Postage() {
  311. let money = +this.moneyAll.storePostage;
  312. if (money == 0) {
  313. return '免运费';
  314. } else {
  315. return '¥' + money;
  316. }
  317. },
  318. payAllMoney() {
  319. return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
  320. }
  321. },
  322. methods: {
  323. changeRz(){
  324. if(this.checkedIsRz!=this.isRz){
  325. this.checkedIsRz=this.isRz
  326. }else{
  327. this.checkedIsRz=0;
  328. }
  329. },
  330. // 添加商品到购物车
  331. cartAdd(opt) {
  332. let obj = this;
  333. cartAdd({
  334. cartNum: 1, //商品数量
  335. new: 1, //商品是否新增加到购物车1为不加入0为加入
  336. mer_id: +opt.merid, //商店id
  337. combinationId: +opt.gid, //拼团商品id
  338. productId: +opt.pid, //普通商品id
  339. is_consumer: 0,
  340. // type: obj.is_consumer == 1 ?1: 0
  341. })
  342. .then(function(e) {
  343. let da = e.data;
  344. // 獲取购物车号
  345. obj.cartId = da.cartId;
  346. // 加载数据
  347. obj.loadData();
  348. })
  349. .catch(e => {
  350. console.log(e);
  351. });
  352. },
  353. // 转换字符串为数字
  354. moneyNum: function(value) {
  355. return +value;
  356. },
  357. // 加载用户基础信息
  358. userinfo() {
  359. let obj = this;
  360. userinfo({}).then(({
  361. data
  362. }) => {
  363. // 用于保存当前对象,优化加载速度
  364. let ob = obj;
  365. ob.integralAll = data.brokerage_price;
  366. // 保存可用积分抵扣上限
  367. ob.inte_top = data.max_shangxian;
  368. // 保存默认提货人姓名
  369. ob.pickUpInfo.real_name = data.nickname;
  370. // 保存默认提货人手机号
  371. ob.pickUpInfo.phone = data.phone;
  372. });
  373. },
  374. // 计算支付金额
  375. payMoneyNub: function() {
  376. return new Promise((resolve, reject) => {
  377. computedOrderkey({
  378. orderkey: this.orderKey,
  379. useBrokerage: this.checkedPoints ? 1 : 0,
  380. shipping_type: this.tabCurrentIndex + 1, //1是普通2是门店
  381. is_change: this.is_change ? 1 : 0,
  382. latitude: this.addressData.latitude,
  383. longitude: this.addressData.longitude,
  384. addressId: this.addressData.id,
  385. is_consumer: this.is_consumer
  386. })
  387. .then(({
  388. data
  389. }) => {
  390. this.payType = true;
  391. this.integralShow = true;
  392. // 获取支付金额
  393. this.payPrice = +data.result.pay_price
  394. this.integralMoney = data.result.deduction_brokerage_price;
  395. this.moneyAll.use_integral = '';
  396. if(data.result.deduction_brokerage_price>0){
  397. this.moneyAll.use_integral = data.result.deduction_brokerage_price;
  398. }
  399. if(data.result.totalBrokerage>0){
  400. if(this.moneyAll.use_integral!=''){
  401. this.moneyAll.use_integral = data.result.totalBrokerage+'+'+this.moneyAll.use_integral
  402. } else{
  403. this.moneyAll.use_integral = data.result.totalBrokerage
  404. }
  405. }
  406. // 保存邮费
  407. this.moneyAll.storePostage = data.result.pay_postage;
  408. resolve(true);
  409. })
  410. .catch(e => {
  411. console.log(e);
  412. this.integralShow = false;
  413. this.payType = false;
  414. reject(false);
  415. });
  416. });
  417. },
  418. // 是否使用积分
  419. checkedIntegral() {
  420. this.checkedPoints = !this.checkedPoints;
  421. },
  422. //顶部tab点击
  423. tabClick(index) {
  424. this.tabCurrentIndex = index;
  425. },
  426. //显示优惠券面板
  427. toggleMask(type) {
  428. let timer = type === 'show' ? 10 : 300;
  429. let state = type === 'show' ? 1 : 0;
  430. this.maskState = 2;
  431. setTimeout(() => {
  432. this.maskState = state;
  433. }, timer);
  434. },
  435. // 载入数据
  436. loadData: async function() {
  437. let obj = this;
  438. confirm({
  439. cartId: obj.cartId + ''
  440. }).then(({
  441. data
  442. }) => {
  443. obj.addressData = data.addressInfo || {};
  444. obj.shopList = data.cartInfo; //商品列表
  445. obj.moneyAll = data.priceGroup; //金额数据
  446. obj.orderKey = data.orderKey; //订单key
  447. (obj.system_store = data.system_store), //到店自提列表
  448. obj.shopAddress = data.system_store //选中的地址
  449. // 计算金额
  450. this.payMoneyNub().then(e => {
  451. this.seriationCode(data.cartInfo);
  452. });
  453. });
  454. },
  455. // 购买数量变化
  456. numberChange(data) {
  457. this.number = data.number;
  458. },
  459. // 修改支付方式
  460. changePayType(type) {
  461. this.payType = type;
  462. },
  463. // 判断是否为公排号订单
  464. seriationCode(arr) {
  465. for (var i = 0; i < arr.length; i++) {
  466. if (arr[i].productInfo.is_platoon == 1 && arr.length > 1) {
  467. this.payType = false;
  468. uni.showModal({
  469. title: '公排商品不可与普通商品一起购买',
  470. showCancel: false
  471. });
  472. break;
  473. }
  474. }
  475. },
  476. // 提交订单
  477. submit() {
  478. let obj = this;
  479. // 判断是否为公排商品
  480. obj.seriationCode(obj.shopList);
  481. // 判断是否为积分商品
  482. // if (this.checkedPoints && this.shopList.length > 1) {
  483. // this.$api.msg('积分商品只可单件购买');
  484. // return false;
  485. // }
  486. if (obj.isRz > 0) {
  487. if (obj.isRz != obj.checkedIsRz) {
  488. obj.$api.msg('请填同意勾选说明才可购买');
  489. return
  490. }
  491. }
  492. if (obj.tabCurrentIndex === 1) {
  493. if (!obj.pickUpInfo.real_name) {
  494. obj.$api.msg('请填写用户名');
  495. return false;
  496. }
  497. if (!obj.pickUpInfo.phone) {
  498. obj.$api.msg('请填写手机号');
  499. return false;
  500. }
  501. obj.addressData.real_name = obj.pickUpInfo.real_name;
  502. obj.addressData.phone = obj.pickUpInfo.phone;
  503. }
  504. if (obj.tabCurrentIndex === 0) {
  505. if (!obj.addressData.real_name) {
  506. obj.$api.msg('请选择收货地址');
  507. return false;
  508. }
  509. }
  510. let url = '/pages/money/pay?key=' + obj.orderKey + '&goodsType=' + obj.goodsType;
  511. if (obj.is_consumer == 1) {
  512. url += '&consumer=1'
  513. }
  514. if (obj.pinkid) {
  515. url += '&pinkid=' + obj.pinkid;
  516. }
  517. uni.navigateTo({
  518. url
  519. });
  520. }
  521. }
  522. };
  523. </script>
  524. <style lang="scss">
  525. page {
  526. background: $page-color-base;
  527. padding-bottom: 100rpx;
  528. }
  529. .navbar {
  530. display: flex;
  531. height: 80rpx;
  532. padding: 0 5px;
  533. background: #fff;
  534. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  535. position: relative;
  536. z-index: 10;
  537. .nav-item {
  538. flex: 1;
  539. display: flex;
  540. justify-content: center;
  541. align-items: center;
  542. height: 100%;
  543. font-size: $font-lg + 4rpx;
  544. color: $font-color-dark;
  545. position: relative;
  546. &.current {
  547. color: $base-color;
  548. &:after {
  549. content: '';
  550. position: absolute;
  551. left: 50%;
  552. bottom: 0;
  553. transform: translateX(-50%);
  554. width: 140rpx;
  555. height: 0;
  556. border-bottom: 2px solid $base-color;
  557. }
  558. }
  559. }
  560. }
  561. .address-section {
  562. padding: 30rpx 0;
  563. background: #fff;
  564. position: relative;
  565. border-top: 1px solid $border-color-light;
  566. .order-content {
  567. min-height: 100rpx;
  568. display: flex;
  569. align-items: center;
  570. .addAddress {
  571. text-align: center;
  572. width: 100%;
  573. display: flex;
  574. justify-content: center;
  575. align-items: center;
  576. line-height: 1;
  577. .iconaddition {
  578. font-size: 55rpx;
  579. border-radius: 100rpx;
  580. margin-right: 20rpx;
  581. }
  582. }
  583. }
  584. .iconlocation {
  585. flex-shrink: 0;
  586. display: flex;
  587. align-items: center;
  588. justify-content: center;
  589. width: 90rpx;
  590. color: #888;
  591. font-size: 44rpx;
  592. }
  593. .cen {
  594. display: flex;
  595. flex-direction: column;
  596. flex: 1;
  597. font-size: 28rpx;
  598. color: $font-color-dark;
  599. }
  600. .name {
  601. font-size: 34rpx;
  602. margin-right: 24rpx;
  603. }
  604. .address {
  605. margin-top: 16rpx;
  606. margin-right: 20rpx;
  607. color: $font-color-light;
  608. }
  609. .icon-you {
  610. font-size: 32rpx;
  611. color: $font-color-light;
  612. margin-right: 30rpx;
  613. }
  614. .a-bg {
  615. position: absolute;
  616. left: 0;
  617. bottom: 0;
  618. display: block;
  619. width: 100%;
  620. height: 5rpx;
  621. }
  622. }
  623. .goods-section {
  624. margin-top: 20rpx;
  625. background: #fff;
  626. padding-bottom: 1px;
  627. .g-header {
  628. display: flex;
  629. align-items: center;
  630. height: 84rpx;
  631. padding: 0 30rpx;
  632. position: relative;
  633. }
  634. .logo {
  635. display: block;
  636. width: 50rpx;
  637. height: 50rpx;
  638. border-radius: 100px;
  639. }
  640. .name {
  641. font-size: 30rpx;
  642. color: $font-color-base;
  643. margin-left: 24rpx;
  644. }
  645. .g-item {
  646. display: flex;
  647. padding: 20rpx 30rpx;
  648. image {
  649. flex-shrink: 0;
  650. display: block;
  651. width: 140rpx;
  652. height: 140rpx;
  653. border-radius: 4rpx;
  654. }
  655. .right {
  656. flex: 1;
  657. padding-left: 24rpx;
  658. overflow: hidden;
  659. }
  660. .title {
  661. font-size: 30rpx;
  662. color: $font-color-dark;
  663. }
  664. .spec {
  665. font-size: 26rpx;
  666. color: $font-color-light;
  667. }
  668. .price-box {
  669. display: flex;
  670. align-items: center;
  671. font-size: 32rpx;
  672. color: $font-color-dark;
  673. padding-top: 10rpx;
  674. .price {
  675. margin-bottom: 4rpx;
  676. color: $color-red;
  677. }
  678. .number {
  679. font-size: 26rpx;
  680. color: $font-color-base;
  681. margin-left: 20rpx;
  682. }
  683. }
  684. .step-box {
  685. position: relative;
  686. }
  687. }
  688. }
  689. .yt-list {
  690. margin-top: 16rpx;
  691. background: #fff;
  692. }
  693. .yt-list-cell {
  694. display: flex;
  695. align-items: center;
  696. padding: 10rpx 30rpx 10rpx 40rpx;
  697. line-height: 70rpx;
  698. position: relative;
  699. &.cell-hover {
  700. background: #fafafa;
  701. }
  702. &.b-b:after {
  703. left: 30rpx;
  704. }
  705. .cell-icon {
  706. height: 32rpx;
  707. width: 32rpx;
  708. font-size: 22rpx;
  709. color: #fff;
  710. text-align: center;
  711. line-height: 32rpx;
  712. background: #f85e52;
  713. border-radius: 4rpx;
  714. margin-right: 12rpx;
  715. &.hb {
  716. background: #ffaa0e;
  717. }
  718. &.lpk {
  719. background: #3ab54a;
  720. }
  721. }
  722. .cell-more {
  723. align-self: center;
  724. font-size: 24rpx;
  725. color: $font-color-light;
  726. margin-left: 8rpx;
  727. margin-right: -10rpx;
  728. }
  729. .cell-tit {
  730. flex: 1;
  731. font-size: 26rpx;
  732. color: $font-color-light;
  733. margin-right: 10rpx;
  734. }
  735. .cell-tip {
  736. font-size: 26rpx;
  737. color: $font-color-dark;
  738. &.disabled {
  739. color: $font-color-light;
  740. }
  741. &.active {
  742. color: $base-color;
  743. }
  744. &.red {
  745. color: $base-color;
  746. }
  747. }
  748. .cell-tip-1 {
  749. width: 28rpx;
  750. height: 28rpx;
  751. margin-right: 10rpx;
  752. }
  753. &.desc-cell {
  754. .cell-tit {
  755. max-width: 90rpx;
  756. }
  757. }
  758. .desc {
  759. flex: 1;
  760. text-align: right;
  761. font-size: $font-base;
  762. color: $font-color-dark;
  763. }
  764. }
  765. /* 支付列表 */
  766. .pay-list {
  767. padding-left: 40rpx;
  768. margin-top: 16rpx;
  769. background: #fff;
  770. .pay-item {
  771. display: flex;
  772. align-items: center;
  773. padding-right: 20rpx;
  774. line-height: 1;
  775. height: 110rpx;
  776. position: relative;
  777. }
  778. .icon-weixinzhifu {
  779. width: 80rpx;
  780. font-size: 40rpx;
  781. color: #6bcc03;
  782. }
  783. .icon-alipay {
  784. width: 80rpx;
  785. font-size: 40rpx;
  786. color: #06b4fd;
  787. }
  788. .icon-xuanzhong2 {
  789. display: flex;
  790. align-items: center;
  791. justify-content: center;
  792. width: 60rpx;
  793. height: 60rpx;
  794. font-size: 40rpx;
  795. color: $base-color;
  796. }
  797. .tit {
  798. font-size: 32rpx;
  799. color: $font-color-dark;
  800. flex: 1;
  801. }
  802. }
  803. .footer {
  804. position: fixed;
  805. left: 0;
  806. bottom: 0;
  807. z-index: 995;
  808. display: flex;
  809. align-items: center;
  810. width: 100%;
  811. height: 90rpx;
  812. justify-content: space-between;
  813. font-size: 30rpx;
  814. background-color: #fff;
  815. z-index: 998;
  816. color: $font-color-base;
  817. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  818. .price-content {
  819. padding-left: 30rpx;
  820. }
  821. .price-tip {
  822. color: $font-color-base;
  823. margin-left: 8rpx;
  824. }
  825. .price-top-1 {
  826. margin-left: 8rpx;
  827. height: 32rpx;
  828. width: 32rpx;
  829. margin-right: 8rpx;
  830. }
  831. .price {
  832. font-size: 36rpx;
  833. color: $font-color-base;
  834. }
  835. .submit {
  836. display: flex;
  837. align-items: center;
  838. justify-content: center;
  839. width: 280rpx;
  840. height: 100%;
  841. color: #fff;
  842. font-size: 32rpx;
  843. background-color: $base-color;
  844. &.submitNo {
  845. background-color: $font-color-disabled;
  846. }
  847. }
  848. }
  849. /* 优惠券面板 */
  850. .mask {
  851. display: flex;
  852. align-items: flex-end;
  853. position: fixed;
  854. left: 0;
  855. top: var(--window-top);
  856. bottom: 0;
  857. width: 100%;
  858. background: rgba(0, 0, 0, 0);
  859. z-index: 9995;
  860. transition: 0.3s;
  861. .mask-content {
  862. width: 100%;
  863. min-height: 30vh;
  864. max-height: 70vh;
  865. background: #f3f3f3;
  866. transform: translateY(100%);
  867. transition: 0.3s;
  868. overflow-y: scroll;
  869. }
  870. &.none {
  871. display: none;
  872. }
  873. &.show {
  874. background: rgba(0, 0, 0, 0.4);
  875. .mask-content {
  876. transform: translateY(0);
  877. }
  878. }
  879. }
  880. /* 优惠券列表 */
  881. .coupon-item {
  882. display: flex;
  883. flex-direction: column;
  884. margin: 20rpx 24rpx;
  885. background: #fff;
  886. .con {
  887. display: flex;
  888. align-items: center;
  889. position: relative;
  890. height: 120rpx;
  891. padding: 0 30rpx;
  892. &:after {
  893. position: absolute;
  894. left: 0;
  895. bottom: 0;
  896. content: '';
  897. width: 100%;
  898. height: 0;
  899. border-bottom: 1px dashed #f3f3f3;
  900. transform: scaleY(50%);
  901. }
  902. }
  903. .left {
  904. display: flex;
  905. flex-direction: column;
  906. justify-content: center;
  907. flex: 1;
  908. overflow: hidden;
  909. height: 100rpx;
  910. }
  911. .title {
  912. font-size: 32rpx;
  913. color: $font-color-dark;
  914. margin-bottom: 10rpx;
  915. }
  916. .time {
  917. font-size: 24rpx;
  918. color: $font-color-light;
  919. }
  920. .right {
  921. display: flex;
  922. flex-direction: column;
  923. justify-content: center;
  924. align-items: center;
  925. font-size: 26rpx;
  926. color: $font-color-base;
  927. height: 100rpx;
  928. }
  929. .price {
  930. font-size: 44rpx;
  931. color: $base-color;
  932. &:before {
  933. content: '¥';
  934. font-size: 34rpx;
  935. }
  936. }
  937. .tips {
  938. font-size: 24rpx;
  939. color: $font-color-light;
  940. line-height: 60rpx;
  941. padding-left: 30rpx;
  942. }
  943. .circle {
  944. position: absolute;
  945. left: -6rpx;
  946. bottom: -10rpx;
  947. z-index: 10;
  948. width: 20rpx;
  949. height: 20rpx;
  950. background: #f3f3f3;
  951. border-radius: 100px;
  952. &.r {
  953. left: auto;
  954. right: -6rpx;
  955. }
  956. }
  957. }
  958. </style>