order.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. <template>
  2. <view>
  3. <view class="custom_addr" @click="showAddrPopup()">
  4. <view class="contact_user">
  5. <text class="contact_none" v-if="!checkedAddr.id">请选择收货地址</text>
  6. <text class="contact_name">{{ checkedAddr.contact_name }}</text>
  7. <text class="contact_phone">{{ checkedAddr.contact_phone }}</text>
  8. <text class="contact_more">&gt;</text>
  9. <view class="contact_shop text-ellipsis" style="width: 250rpx; text-align: end">
  10. <text v-if="checkedAddr.shop_type">({{ $CONSTANTS.SHOP_TYPES[checkedAddr.shop_type] }})&nbsp;</text>
  11. {{ checkedAddr.contact_shop }}
  12. </view>
  13. </view>
  14. <view class="contact_addr" style="display: flex">
  15. {{ checkedAddr.contact_province }} {{ checkedAddr.contact_city }} {{ checkedAddr.contact_area }}
  16. {{ checkedAddr.contact_addr }}
  17. </view>
  18. </view>
  19. <view style="padding-bottom: 180rpx">
  20. <view class="car_list">
  21. <view v-for="(pItem, pIndex) in cartListByGroup" :key="pIndex">
  22. <view class="business_name">{{ pItem.business_name }}</view>
  23. <view class="car_item" v-for="(item, index) in pItem.products" :key="index">
  24. <view class="box_left">
  25. <image class="car_image" :src="item.thumb" mode=""></image>
  26. </view>
  27. <view class="box_center">
  28. <view class="car_name">{{ item.name }}</view>
  29. <view class="car_spec">{{ item.spec }}</view>
  30. <view v-if="item.promo_title" class="promo_title">
  31. <text v-for="(promoText, index) in getPromoText(item.promo_title)" :key="index">{{ promoText }}</text>
  32. </view>
  33. <view class="car_price">
  34. <text class="price">¥{{ item.price }}</text>
  35. </view>
  36. </view>
  37. <view class="box_right">
  38. <view class="buy_num_box">
  39. <view class="buy_num">共{{ item.buy_num }}件</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="car_item" v-for="(item, index) in promoRebateList" :key="index">
  45. <view class="box_left">
  46. <image class="car_image" :src="item.thumb" mode=""></image>
  47. </view>
  48. <view class="box_center">
  49. <view class="car_name">
  50. <text v-if="item.promo_rebate_id">【赠品】</text>
  51. {{ item.name }}
  52. </view>
  53. <view class="car_spec">{{ item.spec }}</view>
  54. <view class="car_price">
  55. <text class="price">¥{{ item.price }}</text>
  56. </view>
  57. </view>
  58. <view class="box_right">
  59. <view class="buy_num_box">
  60. <view class="buy_num">共{{ item.buy_num }}件</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view>
  66. <view class="to_select_coupon" v-if="couponList.length" @click="popupCoupon()">
  67. <text>优惠券</text>
  68. <view class="coupon_deduction">{{ couponUsed }}</view>
  69. </view>
  70. <view class="to_select_coupon" v-if="reduction > 0">
  71. <text>满减</text>
  72. <view class="coupon_deduction">-{{ reduction }}</view>
  73. </view>
  74. <view class="to_select_coupon" v-if="discount > 0">
  75. <text>商品折扣</text>
  76. <view class="coupon_deduction">-{{ discount }}</view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- <view class="price_content">
  81. <view class="price_content_title">价格明细</view>
  82. <view class="price_content_item"> </view>
  83. </view> -->
  84. <view class="bottom_box">
  85. <view class="price_box">
  86. 合计:
  87. <text class="price_total">¥{{ priceTotal }}</text>
  88. </view>
  89. <button class="to_order" @click="createOrder()" data-eventsync="true">{{ is_pay ? '立即支付' : '立即预约' }}</button>
  90. </view>
  91. <uni-popup ref="popup" type="bottom" class="popup" background-color="#FFFFFF" @touchmove.stop.prevent="() => {}">
  92. <view class="coupon_list">
  93. <view class="coupon_item" v-for="(item, index) in couponList" :key="index" @click="checkedCoupon(index)">
  94. <view class="box_left">
  95. <view class="rebate" v-if="item.rebate_type == 1">¥{{ item.rebate }}</view>
  96. <view class="rebate" v-if="item.rebate_type == 2">打 {{ item.rebate }} 折</view>
  97. <view class="rebate" v-if="item.rebate_type == 3">
  98. <text v-if="item.rebate_scope.length">{{ item.rebate_scope[0].product_name }}</text>
  99. </view>
  100. <view class="std_pay">满{{ item.std_pay }}</view>
  101. </view>
  102. <view class="box_right">
  103. <view class="coupon_title">
  104. <view class="coupon_name" v-if="item.rebate_type == 1">满减券</view>
  105. <view class="coupon_name" v-if="item.rebate_type == 2">折扣券</view>
  106. <view class="coupon_name" v-if="item.rebate_type == 3">赠品券</view>
  107. </view>
  108. <view class="product_scope">
  109. <text class="" v-if="item.type_id == 1">限定商品可用</text>
  110. <text class="" v-if="item.type_id == 2">全场可用</text>
  111. <view class="check_label">
  112. <view class="isstd" v-if="!item.is_std">不可用</view>
  113. <image
  114. class="checkbox"
  115. v-if="item.is_std"
  116. :src="item.checked ? 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/checked.png' : 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/checkbox.png'"
  117. ></image>
  118. </view>
  119. </view>
  120. <view class="coupon_info">
  121. <view class="coupon_exp">{{ item.exp_time }} 到期</view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </uni-popup>
  127. <uni-popup ref="addrPopup" type="bottom" class="popup" background-color="#FFFFFF">
  128. <view class="popup_title">
  129. 收货地址
  130. <navigator url="/pages/addr/index?notify=addr" class="to_addr_page">管理</navigator>
  131. </view>
  132. <view class="addr_list">
  133. <view class="addr_item" v-for="(item, index) in addrList" :key="index" @click="checkedAddrItem(item)">
  134. <view class="radio_label">
  135. <image
  136. class="radio_icon"
  137. :src="item.id == checkedAddr.id ? 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/radioed.png' : 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/radio.png'"
  138. ></image>
  139. </view>
  140. <view class="contact_user">
  141. <text class="contact_name">{{ item.contact_name }}</text>
  142. <text class="contact_phone">{{ item.contact_phone }}</text>
  143. <text class="contact_default" v-if="item.is_default">默认</text>
  144. <view class="contact_shop text-ellipsis" style="width: 250rpx; text-align: end">
  145. <text v-if="item.shop_type">({{ $CONSTANTS.SHOP_TYPES[item.shop_type] }})&nbsp;</text>
  146. {{ item.contact_shop }}
  147. </view>
  148. </view>
  149. <view class="contact_addr" style="display: flex">{{ item.contact_province }} {{ item.contact_city }} {{ item.contact_area }} {{ item.contact_addr }}</view>
  150. </view>
  151. </view>
  152. <view class="create_box">
  153. <navigator url="/pages/addr/index?notify=addr&type=create" class="create_addr">新建收货地址</navigator>
  154. </view>
  155. </uni-popup>
  156. </view>
  157. </template>
  158. <script>
  159. export default {
  160. data() {
  161. return {
  162. //序列化购物车列表
  163. cartListByGroup: [],
  164. // 购物车列表
  165. cartList: [],
  166. // 优惠券列表
  167. couponList: [],
  168. //赠品列表
  169. promoRebateList: [],
  170. // 请求参数
  171. requestParam: {
  172. cart_ids: '',
  173. },
  174. // 总价
  175. priceTotal: '0.00',
  176. discount: '0.00',
  177. reduction: '0.00',
  178. // 优惠券使用
  179. couponUsed: '去使用 >',
  180. // 扣减金额
  181. rebatePrice: 0.0,
  182. // 已经选择的优惠券ID
  183. customCoupon: 0,
  184. // 地址列表
  185. addrList: [],
  186. // 已选地址
  187. checkedAddr: {
  188. id: 0,
  189. contact_name: '',
  190. contact_phone: '',
  191. contact_province: '',
  192. contact_city: '',
  193. contact_area: '',
  194. contact_addr: '',
  195. is_default: 0,
  196. },
  197. is_pay: 0,
  198. };
  199. },
  200. onLoad(param) {
  201. // 获取路由参数
  202. this.requestParam.cart_ids = param.cart_ids;
  203. var that = this;
  204. // 监听地址变动
  205. uni.$on('addr_list_change', function (data) {
  206. // 地址列表
  207. that.addrList = data.list;
  208. });
  209. },
  210. onShow() {
  211. // 结果
  212. this.$http.request('api/shop_cart/check_list', this.requestParam).then((re) => {
  213. if (re.code == 'success') {
  214. // 赋值
  215. this.cartList = re.data;
  216. this.cartListByGroup = this.formatGroupedData(re.data);
  217. this.promoRebateList = re.promoRebateList;
  218. this.discount = re.discount;
  219. this.reduction = re.reduction;
  220. // 结果
  221. this.$http.request('api/custom_coupon/get_checked', this.requestParam).then((re) => {
  222. if (re.code == 'success') {
  223. // 赋值
  224. this.couponList = re.data;
  225. // 推荐使用的优惠券
  226. let rebatePrice = 0;
  227. // 循环优惠券
  228. for (let i in this.couponList) {
  229. /* 商品的总价格,决定是否可用 */
  230. var totalPrice = 0.0;
  231. // 循环产品,
  232. for (let j in this.cartList) {
  233. // 如果是商品券
  234. if (this.couponList[i].type_id == 1) {
  235. // 判断商品是不是在商品范围
  236. var isScope = false;
  237. // 循环商品范围
  238. for (let k in this.couponList[i].product_scope) {
  239. // 如果存在商品范围
  240. if (this.couponList[i].product_scope[k].product_id == this.cartList[j].product_id) isScope = true;
  241. }
  242. // 范围内的做计算
  243. if (isScope) {
  244. totalPrice = this.$decimal.add(totalPrice, this.$decimal.mul(this.cartList[j].price, this.cartList[j].buy_num));
  245. }
  246. // 如果排除商品
  247. } else if (this.couponList[i].type_id == 3) {
  248. // 判断商品是不是在排除范围
  249. var isExclude = false;
  250. // 循环排除范围
  251. for (let k in this.couponList[i].product_exclude) {
  252. // 如果存在排除范围
  253. if (this.couponList[i].product_exclude[k].product_id == this.cartList[j].product_id) isExclude = true;
  254. }
  255. // 不在排除内的做计算
  256. if (!isExclude) {
  257. totalPrice = this.$decimal.add(totalPrice, this.$decimal.mul(this.cartList[j].price, this.cartList[j].buy_num));
  258. }
  259. // 店铺券
  260. } else {
  261. // 折扣券以及满减券的话,计算价格
  262. totalPrice = this.$decimal.add(totalPrice, this.$decimal.mul(this.cartList[j].price, this.cartList[j].buy_num));
  263. }
  264. // 判断价格到不到限额
  265. this.couponList[i].is_std = parseFloat(totalPrice.toFixed(2)) >= parseFloat(this.$decimal.mul(this.couponList[i].std_pay, 1).toFixed(2));
  266. // 如果可用的话,并且没有主动选择优惠券
  267. if (this.couponList[i].is_std) {
  268. // 优惠金额
  269. let newRebatePrice = 0.0;
  270. // 计算满减价格
  271. if (this.couponList[i].rebate_type == 1) {
  272. // 计算扣减数据
  273. newRebatePrice = this.$decimal.mul(this.couponList[i].rebate, 1);
  274. }
  275. // 计算折扣价格
  276. if (this.couponList[i].rebate_type == 2) {
  277. // 折扣
  278. newRebatePrice = this.$decimal.mul(totalPrice, this.couponList[i].rebate);
  279. // 减数
  280. newRebatePrice = this.$decimal.sub(totalPrice, newRebatePrice.mul(0.1));
  281. }
  282. // 判断哪个比较优惠
  283. if (parseFloat(rebatePrice.toFixed(2)) < parseFloat(newRebatePrice.toFixed(2))) {
  284. // 覆盖价格
  285. rebatePrice = parseFloat(newRebatePrice.toFixed(2));
  286. // 选中
  287. this.checkedCoupon(i);
  288. }
  289. }
  290. }
  291. }
  292. }
  293. });
  294. // 计算价格
  295. this.priceHandler();
  296. }
  297. });
  298. // 地址列表
  299. this.getAddrList();
  300. },
  301. methods: {
  302. // 转换为数组格式
  303. formatGroupedData(list) {
  304. const groupedData = list.reduce((result, item) => {
  305. const { business_id, business_name } = item;
  306. // 如果该 business_id 的分组不存在,则初始化该分组
  307. if (!result[business_id]) {
  308. result[business_id] = {
  309. business_id,
  310. business_name,
  311. products: [],
  312. checked: false,
  313. };
  314. }
  315. // 将商品添加到对应的 business_id 分组
  316. result[business_id].products.push(item);
  317. return result;
  318. }, {});
  319. return groupedData;
  320. },
  321. // 地址弹出层
  322. showAddrPopup() {
  323. // 显示下单弹出层
  324. this.$refs.addrPopup.open('bottom');
  325. },
  326. // 价格计算
  327. priceHandler() {
  328. // 总价格
  329. let priceTotal = 0;
  330. let pay_status = false;
  331. let reservation_status = false;
  332. // 循环处理
  333. for (let index in this.cartList) {
  334. priceTotal = this.$decimal.add(priceTotal, this.$decimal.mul(this.cartList[index].price, this.cartList[index].buy_num));
  335. if (this.cartList[index].is_pay == 0) {
  336. reservation_status = true;
  337. }
  338. if (this.cartList[index].is_pay == 1) {
  339. pay_status = true;
  340. }
  341. }
  342. // 扣减数据
  343. priceTotal = this.$decimal.sub(priceTotal, this.rebatePrice);
  344. priceTotal = this.$decimal.sub(priceTotal, this.reduction);
  345. priceTotal = this.$decimal.sub(priceTotal, this.discount);
  346. // 小数点保留
  347. this.priceTotal = priceTotal.toFixed(2);
  348. if (pay_status && reservation_status) {
  349. this.is_pay = 2;
  350. } else if (pay_status) {
  351. this.is_pay = 1;
  352. } else if (reservation_status) {
  353. this.is_pay = 0;
  354. }
  355. },
  356. // 创建订单
  357. createOrder() {
  358. // 不可预约
  359. if (!this.$checkAccess.alertCity()) return;
  360. // 需要下单的产品列表
  361. let productList = [];
  362. // 循环列表数据
  363. for (let index in this.cartList) {
  364. // 购买数量必须大于0的才行
  365. if (this.cartList[index].buy_num > 0) {
  366. // 追加需要下单的数据
  367. productList.push({
  368. product_id: this.cartList[index].product_id,
  369. buy_num: this.cartList[index].buy_num,
  370. product_skuid: this.cartList[index].skuid,
  371. shop_cart_id: this.cartList[index].id,
  372. });
  373. }
  374. }
  375. if (productList.length <= 0) {
  376. uni.showToast({
  377. title: '未选择可购买的产品',
  378. icon: 'none',
  379. });
  380. return;
  381. }
  382. // 地址未填
  383. if (!this.checkedAddr.id) {
  384. uni.showToast({
  385. title: '请选择收货地址',
  386. icon: 'none',
  387. });
  388. return;
  389. }
  390. if (this.is_pay == 2) {
  391. uni.showToast({
  392. title: '混合产品,无法下单',
  393. icon: 'none',
  394. });
  395. return;
  396. }
  397. //需要下单的产品信息参数传给OrederCompletion页面
  398. let productInfo = [];
  399. for (let index in this.cartList) {
  400. // 购买数量必须大于0的才行
  401. if (this.cartList[index].buy_num > 0) {
  402. // 追加需要下单的数据
  403. productInfo.push({
  404. name: this.cartList[index].name,
  405. spec: this.cartList[index].spec,
  406. price: this.cartList[index].price,
  407. });
  408. }
  409. }
  410. // 转成json字符串
  411. productInfo = JSON.stringify(productInfo);
  412. //加密json格式成编码数组
  413. let encodedArray = encodeURIComponent(productInfo);
  414. // 转成json字符串传输
  415. productList = JSON.stringify(productList);
  416. // 请求接口
  417. this.$http
  418. .request(
  419. 'api/orders/create',
  420. {
  421. product_list: productList,
  422. custom_coupon_id: this.customCoupon,
  423. is_cart: 1,
  424. addr_id: this.checkedAddr.id,
  425. is_pay: this.is_pay,
  426. },
  427. 'post'
  428. )
  429. .then((re) => {
  430. // 判断结果
  431. if (re.code == 'success') {
  432. if (this.is_pay) {
  433. // 跳转到支付确认页面
  434. let orderInfo = re.data;
  435. orderInfo = JSON.stringify(orderInfo);
  436. let params = encodeURIComponent(orderInfo);
  437. uni.navigateTo({ url: `/pages/orders/confirm?params=${params}` });
  438. } else {
  439. // 跳转到报单完成页面
  440. uni.navigateTo({
  441. url: `/pages/orders/completion?params=${encodedArray}`,
  442. });
  443. }
  444. return;
  445. } else {
  446. uni.showModal({
  447. title: re.msg,
  448. showCancel: false,
  449. });
  450. }
  451. });
  452. },
  453. // 弹出优惠券
  454. popupCoupon() {
  455. this.$refs.popup.open();
  456. },
  457. // 选择优惠券
  458. checkedCoupon(index) {
  459. // 单个设置选中/未选
  460. this.couponList[index].checked = this.couponList[index].checked ? 0 : 1;
  461. // 循环处理
  462. for (let i in this.couponList) {
  463. // 有未选的就不做全选
  464. if (index != i) this.couponList[i].checked = 0;
  465. }
  466. // 如果未选中,提示可用
  467. if (!this.couponList[index].checked) this.couponUsed = '去使用 >';
  468. // 已经选择的优惠券ID
  469. this.customCoupon = this.couponList[index].checked ? this.couponList[index].id : 0;
  470. // 计算扣减
  471. this.couponRebate();
  472. // 计算价格
  473. this.priceHandler();
  474. // 关闭弹窗
  475. this.$refs.popup.close();
  476. },
  477. // 计算优惠券扣减
  478. couponRebate() {
  479. // 默认扣减0
  480. this.rebatePrice = 0;
  481. // 循环优惠券
  482. for (let i in this.couponList) {
  483. // 判断是否选中
  484. if (!this.couponList[i].checked) {
  485. // 未选择的不管
  486. continue;
  487. }
  488. /* 商品的总价格,决定是否可用 */
  489. var totalPrice = 0.0;
  490. // 循环产品,
  491. for (let j in this.cartList) {
  492. // 如果是商品券
  493. if (this.couponList[i].type_id == 1) {
  494. // 判断商品是不是在商品范围
  495. var isScope = false;
  496. // 循环商品范围
  497. for (let k in this.couponList[i].product_scope) {
  498. // 如果存在商品范围
  499. if (this.couponList[i].product_scope[k].product_id == this.cartList[j].product_id) isScope = true;
  500. }
  501. // 范围内的做计算
  502. if (isScope) totalPrice = this.$decimal.add(totalPrice, this.$decimal.mul(this.cartList[j].price, this.cartList[j].buy_num));
  503. // 店铺券
  504. } else {
  505. // 折扣券以及满减券的话,计算价格
  506. totalPrice = this.$decimal.add(totalPrice, this.$decimal.mul(this.cartList[j].price, this.cartList[j].buy_num));
  507. }
  508. }
  509. // 如果是可以用的话
  510. if (parseFloat(totalPrice.toFixed(2)) >= parseFloat(this.$decimal.mul(this.couponList[i].std_pay, 1).toFixed(2))) {
  511. // 扣减金额
  512. let rebatePrice = 0;
  513. // 满减
  514. if (this.couponList[i].rebate_type == 1) {
  515. // 计算扣减数据
  516. rebatePrice = this.$decimal.mul(this.couponList[i].rebate, 1);
  517. // 替换文字
  518. this.couponUsed = '¥-' + rebatePrice.toFixed(2);
  519. }
  520. // 折扣
  521. if (this.couponList[i].rebate_type == 2) {
  522. // 折扣
  523. rebatePrice = this.$decimal.mul(totalPrice, this.couponList[i].rebate);
  524. // -0.1 表示折扣
  525. rebatePrice = this.$decimal.sub(totalPrice, rebatePrice.mul(0.1));
  526. // 替换文字
  527. this.couponUsed = '¥-' + rebatePrice.toFixed(2);
  528. }
  529. // 赠品
  530. if (this.couponList[i].rebate_type == 3) {
  531. // 替换文字
  532. this.couponUsed = '送' + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : '');
  533. }
  534. // 小数点保留
  535. this.rebatePrice = rebatePrice.toFixed(2);
  536. }
  537. }
  538. },
  539. // 选择地址
  540. checkedAddrItem(item) {
  541. this.checkedAddr = item;
  542. this.$refs.addrPopup.close();
  543. },
  544. getAddrList() {
  545. // 判断数据
  546. this.$http.request('api/custom_addr/get_list').then((callback) => {
  547. // 获取成功
  548. if (callback.code == 'success') {
  549. this.addrList = callback.data;
  550. // 如果有的话
  551. if (this.addrList.length) {
  552. // 获取默认的
  553. for (let i in this.addrList) {
  554. // 如果是默认的
  555. if (this.addrList[i].is_default) this.checkedAddr = this.addrList[i];
  556. }
  557. // 如果没有默认的话
  558. if (!this.checkedAddr.id) {
  559. this.checkedAddr = this.addrList[this.addrList.length - 1];
  560. }
  561. }
  562. }
  563. });
  564. },
  565. },
  566. computed: {
  567. getPromoText() {
  568. return (promo_title) => {
  569. //在逗号增加换行符
  570. if (!promo_title) return [];
  571. return promo_title.split(';');
  572. };
  573. },
  574. },
  575. };
  576. </script>
  577. <style lang="less">
  578. .custom_addr {
  579. width: 680rpx;
  580. display: block;
  581. font-size: 24rpx;
  582. overflow: hidden;
  583. margin: 0rpx auto;
  584. line-height: 40rpx;
  585. padding: 20rpx 35rpx;
  586. background-color: #ffffff;
  587. border-bottom: 2rpx solid #dddddd;
  588. .contact_user {
  589. display: block;
  590. font-size: 24rpx;
  591. line-height: 50rpx;
  592. .contact_none {
  593. font-size: 26rpx;
  594. font-weight: bold;
  595. }
  596. .contact_name {
  597. font-size: 26rpx;
  598. font-weight: bold;
  599. margin-right: 16rpx;
  600. }
  601. .contact_more {
  602. float: right;
  603. font-size: 40rpx;
  604. font-weight: bold;
  605. }
  606. .contact_shop {
  607. float: right;
  608. font-size: 26rpx;
  609. margin-right: 16rpx;
  610. }
  611. }
  612. .contact_addr {
  613. width: 620rpx;
  614. display: block;
  615. font-size: 24rpx;
  616. line-height: 30rpx;
  617. padding: 10rpx 5rpx;
  618. }
  619. }
  620. .car_list {
  621. display: block;
  622. overflow: hidden;
  623. margin: 0rpx auto;
  624. margin-top: 20rpx;
  625. background: #ffffff;
  626. .business_name {
  627. padding: 8rpx 35rpx;
  628. border-bottom: 1px solid #f3f3f3;
  629. font-size: 32rpx;
  630. z-index: 1;
  631. display: flex;
  632. align-items: center;
  633. .business_icon {
  634. width: 48rpx;
  635. height: 48rpx;
  636. margin-right: 10rpx;
  637. }
  638. }
  639. .car_item {
  640. display: block;
  641. overflow: hidden;
  642. margin: 0rpx auto;
  643. padding: 20rpx 35rpx;
  644. border-bottom: 2rpx solid #f3f3f3;
  645. .box_left {
  646. float: left;
  647. width: 140rpx;
  648. height: 190rpx;
  649. margin-top: 10rpx;
  650. .car_image {
  651. width: 140rpx;
  652. height: 140rpx;
  653. border-radius: 5rpx;
  654. }
  655. }
  656. .box_center {
  657. float: left;
  658. width: 300rpx;
  659. margin-left: 25rpx;
  660. .car_name {
  661. max-height: 70rpx;
  662. font-size: 30rpx;
  663. line-height: 40rpx;
  664. overflow: hidden;
  665. white-space: nowrap;
  666. /* 不换行 */
  667. overflow: hidden;
  668. /* 隐藏超出的内容 */
  669. text-overflow: ellipsis;
  670. /* 用省略号表示被隐藏的部分 */
  671. }
  672. .car_spec {
  673. color: #999999;
  674. font-size: 24rpx;
  675. line-height: 60rpx;
  676. max-height: 60rpx;
  677. overflow: hidden;
  678. }
  679. .promo_title {
  680. max-width: 240rpx;
  681. font-size: 20rpx;
  682. line-height: 40rpx;
  683. overflow: hidden;
  684. padding: 0rpx 0rpx;
  685. color: #dd524d;
  686. display: flex;
  687. flex-direction: column;
  688. //超出省省略号
  689. // white-space: nowrap; /* 不换行 */
  690. // overflow: hidden; /* 隐藏超出的内容 */
  691. // text-overflow: ellipsis; /* 用省略号表示被隐藏的部分 */
  692. }
  693. .car_price {
  694. font-size: 30rpx;
  695. line-height: 60rpx;
  696. .price {
  697. color: red;
  698. }
  699. }
  700. }
  701. .box_right {
  702. float: right;
  703. width: 185rpx;
  704. .buy_num_box {
  705. float: right;
  706. color: #333333;
  707. overflow: hidden;
  708. font-size: 24rpx;
  709. margin-top: 130rpx;
  710. text-align: center;
  711. .buy_num {
  712. float: left;
  713. width: 100rpx;
  714. height: 30rpx;
  715. font-size: 24rpx;
  716. line-height: 30rpx;
  717. padding: 0rpx 0rpx;
  718. border-radius: 8rpx;
  719. }
  720. }
  721. }
  722. }
  723. .car_item:last-child {
  724. border-bottom: none;
  725. }
  726. }
  727. .to_select_coupon {
  728. display: block;
  729. height: 120rpx;
  730. font-size: 30rpx;
  731. margin: 20rpx auto;
  732. background: #ffffff;
  733. padding: 0rpx 35rpx;
  734. line-height: 120rpx;
  735. .coupon_deduction {
  736. color: red;
  737. float: right;
  738. font-size: 26rpx;
  739. }
  740. }
  741. .to_select_coupon:last-child {
  742. margin-bottom: 160rpx;
  743. }
  744. .bottom_box {
  745. left: 0rpx;
  746. z-index: 9;
  747. width: 100%;
  748. height: 140rpx;
  749. display: block;
  750. position: fixed;
  751. overflow: hidden;
  752. background: #ffffff;
  753. padding: 0rpx 35rpx;
  754. bottom: var(--window-bottom);
  755. .price_box {
  756. float: left;
  757. width: 500rpx;
  758. display: block;
  759. color: #666666;
  760. font-size: 26rpx;
  761. text-align: right;
  762. line-height: 100rpx;
  763. margin-right: 20rpx;
  764. .price_total {
  765. color: red;
  766. font-size: 30rpx;
  767. }
  768. }
  769. .to_order {
  770. float: left;
  771. width: 180rpx;
  772. height: 80rpx;
  773. display: block;
  774. color: #ffffff;
  775. font-size: 28rpx;
  776. margin-top: 10rpx;
  777. line-height: 80rpx;
  778. padding: 0rpx 0rpx;
  779. text-align: center;
  780. border-radius: 40rpx;
  781. background-color: #f89c33;
  782. }
  783. }
  784. .popup {
  785. .popup_title {
  786. display: block;
  787. overflow: hidden;
  788. margin: 0rpx auto;
  789. font-size: 36rpx;
  790. height: 120rpx;
  791. line-height: 120rpx;
  792. padding: 0rpx 20rpx;
  793. border-bottom: 10rpx solid #f8f8f8;
  794. .to_addr_page {
  795. float: right;
  796. color: #f59a23;
  797. display: block;
  798. height: 120rpx;
  799. line-height: 120rpx;
  800. font-size: 26rpx;
  801. padding: 0rpx 10rpx;
  802. }
  803. }
  804. .coupon_list {
  805. display: block;
  806. overflow: hidden;
  807. margin: 10rpx auto;
  808. min-height: 600rpx;
  809. background: #ffffff;
  810. padding-bottom: 50rpx;
  811. .coupon_item {
  812. height: 200rpx;
  813. display: block;
  814. margin: 10rpx auto;
  815. border-bottom: 2rpx solid #dddddd;
  816. .box_left {
  817. float: left;
  818. width: 160rpx;
  819. height: 160rpx;
  820. font-size: 20rpx;
  821. text-align: center;
  822. margin-left: 35rpx;
  823. line-height: 60rpx;
  824. margin-top: 20rpx;
  825. background: pink;
  826. .rebate {
  827. width: 120rpx;
  828. height: 60rpx;
  829. margin: 0rpx auto;
  830. line-height: 60rpx;
  831. margin-top: 20rpx;
  832. overflow: hidden;
  833. white-space: nowrap;
  834. text-overflow: ellipsis;
  835. }
  836. }
  837. .box_right {
  838. float: left;
  839. width: 485rpx;
  840. margin-left: 35rpx;
  841. padding-top: 20rpx;
  842. .coupon_title {
  843. width: 485rpx;
  844. max-height: 80rpx;
  845. font-size: 30rpx;
  846. overflow: hidden;
  847. line-height: 40rpx;
  848. padding: 0rpx 0rpx;
  849. .coupon_name {
  850. float: left;
  851. height: 40rpx;
  852. width: 380rpx;
  853. }
  854. .coupon_status {
  855. width: 85rpx;
  856. float: right;
  857. color: #999999;
  858. font-size: 24rpx;
  859. }
  860. }
  861. .product_scope {
  862. width: 485rpx;
  863. height: 80rpx;
  864. color: #999999;
  865. font-size: 24rpx;
  866. overflow: hidden;
  867. line-height: 80rpx;
  868. .check_label {
  869. float: right;
  870. display: block;
  871. overflow: hidden;
  872. padding: 20rpx 20rpx;
  873. .isstd {
  874. line-height: 40rpx;
  875. }
  876. .checkbox {
  877. float: right;
  878. width: 40rpx;
  879. height: 40rpx;
  880. }
  881. }
  882. }
  883. .coupon_info {
  884. width: 485rpx;
  885. max-height: 80rpx;
  886. font-size: 30rpx;
  887. overflow: hidden;
  888. line-height: 40rpx;
  889. padding: 0rpx 0rpx;
  890. .coupon_exp {
  891. float: left;
  892. font-size: 20rpx;
  893. }
  894. }
  895. }
  896. }
  897. .coupon_item:last-child {
  898. border-bottom: none;
  899. }
  900. }
  901. .addr_list {
  902. width: 730rpx;
  903. display: block;
  904. overflow: hidden;
  905. margin: 0rpx auto;
  906. min-height: 500rpx;
  907. .addr_item {
  908. display: block;
  909. font-size: 24rpx;
  910. overflow: hidden;
  911. line-height: 40rpx;
  912. padding: 15rpx 10rpx;
  913. border-radius: 15rpx;
  914. border-bottom: 2rpx solid #dddddd;
  915. .radio_label {
  916. width: 40rpx;
  917. float: left;
  918. height: 50rpx;
  919. padding-top: 30rpx;
  920. margin-right: 20rpx;
  921. .radio_icon {
  922. float: left;
  923. width: 40rpx;
  924. height: 40rpx;
  925. }
  926. }
  927. .contact_user {
  928. float: left;
  929. width: 640rpx;
  930. display: block;
  931. height: 50rpx;
  932. font-size: 24rpx;
  933. line-height: 50rpx;
  934. .contact_name {
  935. font-size: 26rpx;
  936. font-weight: bold;
  937. margin-right: 16rpx;
  938. }
  939. .contact_default {
  940. color: #f59a23;
  941. font-size: 20rpx;
  942. margin-left: 16rpx;
  943. border: 1rpx solid #f59a23;
  944. }
  945. .contact_shop {
  946. float: right;
  947. font-size: 26rpx;
  948. margin-right: 16rpx;
  949. }
  950. }
  951. .contact_addr {
  952. float: left;
  953. width: 640rpx;
  954. display: block;
  955. font-size: 24rpx;
  956. line-height: 30rpx;
  957. padding: 10rpx 5rpx;
  958. }
  959. }
  960. }
  961. .create_box {
  962. height: 140rpx;
  963. display: block;
  964. .create_addr {
  965. width: 700rpx;
  966. height: 80rpx;
  967. display: block;
  968. color: #ffffff;
  969. font-size: 30rpx;
  970. overflow: hidden;
  971. line-height: 80rpx;
  972. padding: 0rpx 0rpx;
  973. text-align: center;
  974. margin: 0rpx auto;
  975. margin-top: 20rpx;
  976. border-radius: 40rpx;
  977. background-color: #f89c33;
  978. }
  979. }
  980. }
  981. .price_content {
  982. background-color: #fff;
  983. position: fixed;
  984. bottom: 140rpx;
  985. padding: 16rpx 26rpx;
  986. width: 100%;
  987. .price_content_title {
  988. font-weight: bold;
  989. margin-bottom: 20rpx;
  990. }
  991. }
  992. </style>