index.vue 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682
  1. <template>
  2. <view>
  3. <view class="order-submission">
  4. <view class="order-submission-box">
  5. <view class="allAddress">
  6. <view
  7. class="address acea-row row-between-wrapper"
  8. @tap="onAddress"
  9. v-if="shippingType == 0"
  10. :style="
  11. store_self_mention
  12. ? ''
  13. : 'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'
  14. "
  15. >
  16. <view class="addressCon" v-if="addressInfo.realName">
  17. <view class="selected-address">
  18. <text class="default" v-if="addressInfo.isDefault">默认</text>
  19. <view class="">
  20. <view class="acea-row">
  21. <text class="line2"
  22. >{{ addressInfo.province }}{{ addressInfo.city
  23. }}{{ addressInfo.district }}{{ addressInfo.detail }}</text
  24. >
  25. </view>
  26. <view class="name"
  27. >{{ addressInfo.realName }}
  28. <text class="phone">{{ addressInfo.phone }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="addressCon" v-else>
  34. <view class="setaddress">设置收货地址</view>
  35. </view>
  36. </view>
  37. <view
  38. class="address acea-row row-between-wrapper"
  39. v-else
  40. @tap="showStoreList"
  41. >
  42. <block v-if="storeList.length > 0">
  43. <view class="addressCon">
  44. <view class="name"
  45. >{{ system_store.name }}
  46. <text class="phone">{{ system_store.phone }}</text>
  47. </view>
  48. <view class="line1">
  49. {{ system_store.address
  50. }}{{ ", " + system_store.detailedAddress }}
  51. </view>
  52. </view>
  53. <view class="iconfont icon-jiantou"></view>
  54. </block>
  55. <block v-else>
  56. <view>暂无门店信息</view>
  57. </block>
  58. </view>
  59. <view class="line">
  60. <image src="/static/images/line.png"></image>
  61. </view>
  62. </view>
  63. <view class="goods">
  64. <orderGoods
  65. :mallType="orderInfoVo.mallType"
  66. :cartInfo="cartInfo"
  67. :orderProNum="orderProNum"
  68. >
  69. </orderGoods>
  70. <view
  71. class="line-item acea-row row-between-wrapper"
  72. @tap="couponTap"
  73. v-if="orderInfoVo.mallType === 0"
  74. >
  75. <view class="item-label">优惠券</view>
  76. <view
  77. class="discount none"
  78. :class="{ none: couponTitle == '请选择' }"
  79. >
  80. {{ couponTitle }}
  81. <image
  82. class="rt-arr"
  83. src="@/static/images/right.png"
  84. mode=""
  85. ></image>
  86. </view>
  87. </view>
  88. <view class="line-item acea-row row-between-wrapper">
  89. <view class="item-label">快递费用</view>
  90. <block v-if="orderInfoVo.mallType === 0">
  91. <view
  92. class="discount"
  93. v-if="
  94. parseFloat(orderInfoVo.freightFee) > 0 &&
  95. orderInfoVo.mallType === 0
  96. "
  97. >
  98. +¥{{ orderInfoVo.freightFee }}
  99. </view>
  100. <view class="discount" v-else>免运费</view>
  101. </block>
  102. <view class="discount" v-else>邮费到付</view>
  103. </view>
  104. </view>
  105. <view class="wrapper">
  106. <view class="item" v-if="textareaStatus">
  107. <view>备注信息</view>
  108. <textarea
  109. v-if="coupon.coupon === false"
  110. placeholder-class="placeholder"
  111. @input="bindHideKeyboard"
  112. value=""
  113. name="mark"
  114. placeholder="请输入备注(可选,如特殊定制需求)"
  115. ></textarea>
  116. </view>
  117. </view>
  118. <view v-if="orderInfoVo.mallType === 0" class="moneyList">
  119. <view class="item acea-row row-between-wrapper">
  120. <view>商品总价:</view>
  121. <view v-if="orderInfoVo.mallType === 0" class="money">
  122. ¥{{ orderInfoVo.payFee || 0 }}
  123. </view>
  124. <view v-else class="money">
  125. 贝币: {{ Number(orderInfoVo.proTotalFee) || 0 }}
  126. </view>
  127. </view>
  128. <view
  129. class="item acea-row row-between-wrapper"
  130. v-if="orderInfoVo.couponFee > 0"
  131. >
  132. <view>优惠券抵扣:</view>
  133. <view class="money">-¥{{ orderInfoVo.couponFee }}</view>
  134. </view>
  135. <!-- <view
  136. class="item acea-row row-between-wrapper"
  137. v-if="orderInfoVo.deductionPrice > 0"
  138. >
  139. <view>积分抵扣:</view>
  140. <view class="money">-¥{{ orderInfoVo.deductionPrice }}</view>
  141. </view> -->
  142. <view
  143. class="item acea-row row-between-wrapper"
  144. v-if="
  145. orderInfoVo?.proTotalWeight && orderInfoVo?.proTotalWeight > 0
  146. "
  147. >
  148. <view>总克重:</view>
  149. <view class="money">{{ orderInfoVo.proTotalWeight }} g</view>
  150. </view>
  151. <view
  152. class="item acea-row row-between-wrapper"
  153. v-if="orderInfoVo.mallType === 0"
  154. >
  155. <view>工费:</view>
  156. <view class="money">¥{{ orderInfoVo.totalLaborCost }}</view>
  157. </view>
  158. <view
  159. class="item acea-row row-between-wrapper"
  160. v-if="
  161. orderInfoVo.mallType === 0 && orderInfoVo?.totalAdditionalAmount
  162. "
  163. >
  164. <view>附加费:</view>
  165. <view class="money">¥{{ orderInfoVo.totalAdditionalAmount }}</view>
  166. </view>
  167. <view
  168. class="item acea-row row-between-wrapper"
  169. v-if="orderInfoVo.freightFee > 0"
  170. >
  171. <view>运费:</view>
  172. <view class="money">¥{{ orderInfoVo.freightFee }}</view>
  173. </view>
  174. <view
  175. v-if="
  176. orderInfoVo.mallType === 0 &&
  177. Number(orderInfoVo.vipLevelDis) !== 0
  178. "
  179. class="item acea-row row-between-wrapper"
  180. >
  181. <view>会员折扣:</view>
  182. <view class="money">-¥{{ orderInfoVo.vipLevelDis }}</view>
  183. </view>
  184. </view>
  185. <!-- 是否使用余料支付 -->
  186. <view class="pay-container">
  187. <view class="item">
  188. <view class="zf-box" v-if="orderInfoVo.mallType == 0">
  189. <view>余料支付方式</view>
  190. </view>
  191. <view class="list" v-if="orderInfoVo.mallType == 0">
  192. <view class="payItem">
  193. <view class="name acea-row row-center-wrapper">
  194. <image
  195. class="pay-icon"
  196. src="@/static/images/au_icon.png"
  197. ></image>
  198. 余料支付
  199. </view>
  200. <view class="tip">
  201. <text class="balance"
  202. >可用余料:
  203. {{ metalTypeMap[metalType].name }}
  204. :{{ metalTypeMap[metalType].balance || 0 }}g</text
  205. >
  206. </view>
  207. </view>
  208. </view>
  209. <view class="zf-box">
  210. <view>工费支付方式</view>
  211. </view>
  212. <view class="list">
  213. <view
  214. v-for="(item, index) in avaliablePayments"
  215. class="payItem"
  216. :class="active == index ? 'on' : ''"
  217. @tap="payItem(index)"
  218. :key="index"
  219. >
  220. <view class="name acea-row row-center-wrapper">
  221. <image
  222. class="pay-icon"
  223. src="https://my-go-easy-im.oss-cn-shenzhen.aliyuncs.com/goeasy-im-%E6%B0%B4%E8%B4%9D%E5%95%86%E5%9F%8E/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20260302114032_816_219.png"
  224. ></image>
  225. <image
  226. class="pay-icon"
  227. v-if="item.name == '余额支付'"
  228. src="@/static/images/balance-icon.png"
  229. ></image>
  230. {{ item.name }}
  231. </view>
  232. <view class="tip">
  233. <text class="balance">{{ item.title }}</text>
  234. <image
  235. class="select-icon"
  236. v-show="active == index"
  237. src="@/static/images/select-active@2x.png"
  238. mode=""
  239. ></image>
  240. <image
  241. class="select-icon"
  242. v-show="active != index"
  243. src="@/static/images/select@2x.png"
  244. mode=""
  245. >
  246. </image>
  247. </view>
  248. </view>
  249. </view>
  250. </view>
  251. </view>
  252. </view>
  253. <view class="kong"></view>
  254. <view class="footer acea-row row-between-wrapper">
  255. <view>
  256. 合计:
  257. <text class="price" v-if="orderInfoVo.mallType === 0">
  258. ¥{{ orderInfoVo.payFee || 0 }}
  259. </text>
  260. <text class="price" v-else>
  261. {{ Number(orderInfoVo.proTotalFee) || 0 }}贝币
  262. </text>
  263. </view>
  264. <view class="settlement" style="z-index: 100" @tap="SubOrder">
  265. 立即结算
  266. </view>
  267. </view>
  268. </view>
  269. <couponListWindow
  270. :coupon="coupon"
  271. @close="closeCouponPopup"
  272. :showPopup="showCouponPopup"
  273. :openType="openType"
  274. @ChangCoupons="ChangCoupons"
  275. :orderShow="orderShow"
  276. ></couponListWindow>
  277. <addressWindow
  278. ref="addressWindowRef"
  279. @changeTextareaStatus="changeTextareaStatus"
  280. :address="address"
  281. :pagesUrl="pagesUrl"
  282. @OnDefaultAddress="OnDefaultAddress"
  283. @OnChangeAddress="OnChangeAddress"
  284. @changeClose="changeClose"
  285. />
  286. <!-- 余额不足modal -->
  287. <up-modal
  288. :showCancelButton="true"
  289. :show="showModal"
  290. title="余额不足"
  291. confirmText="去充值"
  292. @cancel="showModal = false"
  293. @confirm="modalConfirm"
  294. ></up-modal>
  295. <WechatPayment ref="wechatPaymentRef" />
  296. </view>
  297. </template>
  298. <script setup>
  299. // 导入UniApp页面加载生命周期函数
  300. import { onLoad } from "@dcloudio/uni-app";
  301. // 导入Vue3响应式API(ref创建响应式变量、computed计算属性等)
  302. import { ref, computed, watch, onMounted, nextTick } from "vue";
  303. // 导入应用状态管理(全局状态,如登录状态、用户信息等)
  304. import { useAppStore } from "@/stores/app.js";
  305. // 导入提示框工具(封装的toast提示函数)
  306. import { useToast } from "@/hooks/useToast.js";
  307. // 导入支付相关工具(封装的支付逻辑,如提交支付、验证支付渠道等)
  308. import { usePayment } from "@/hooks/usePayment.js";
  309. import WechatPayment from "@/components/payment/WechatPayment.vue";
  310. // 导入订单相关API接口(优惠券、创建订单、计算价格等接口)
  311. import {
  312. getUserAvailableCoupons, // 根据用户和使用位置查询可用优惠券接口
  313. orderCreate, // 创建订单接口
  314. postOrderComputed, // 计算订单价格接口
  315. wechatOrderPay, // 微信支付接口
  316. wechatQueryPayResult, // 微信支付结果查询接口
  317. loadPreOrderApi, // 加载预订单接口
  318. alipayPaymentResult, // 支付宝支付结果查询接口
  319. } from "@/api/order.js";
  320. // 导入用户地址详情API接口
  321. import { getAddressDetail } from "@/api/user.js";
  322. // 导入门店列表API接口
  323. import { storeListApi } from "@/api/store.js";
  324. // 导入工具类(封装的通用工具函数)
  325. import util from "@/utils/util";
  326. // 导入优惠券弹窗组件
  327. import couponListWindow from "@/components/couponListWindow";
  328. // 导入地址选择组件
  329. import addressWindow from "@/components/addressWindow";
  330. // 导入订单商品列表组件
  331. import orderGoods from "@/components/orderGoods";
  332. // 导入登录工具(未登录时跳转登录页)
  333. import { toLogin } from "@/libs/login.js";
  334. import useRealGoldPrice from "@/hooks/useRealGoldPrice";
  335. const { realGoldprice, fetchGoldPrice } = useRealGoldPrice("RTJ_Au");
  336. // 初始化应用状态管理实例(用于获取全局状态)
  337. const appStore = useAppStore();
  338. // 初始化提示框工具(获取toast方法)
  339. const { Toast } = useToast();
  340. // 初始化支付工具(仅支付宝使用)
  341. const { submitPayment, paymentConfig, getAvailableChannels } = usePayment();
  342. // 微信支付状态文案
  343. const WX_PAY_STATUS = {
  344. SUCCESS: "支付成功",
  345. FAIL: "支付失败",
  346. CANCEL: "用户取消支付",
  347. };
  348. // 响应式变量:订单页面标识(用于优惠券组件,控制不显示tab切换)
  349. const orderShow = ref("orderShow");
  350. // 响应式变量:控制备注输入框是否显示
  351. const textareaStatus = ref(true);
  352. // 响应式变量:支付方式列表(包含支付宝、微信、余额等支付方式配置)
  353. const payments = ref([
  354. // {
  355. // name: "支付宝支付", // 支付方式名称
  356. // icon: "icon-zhifubao", // 图标类名
  357. // value: "alipay", // 支付标识值
  358. // title: "支付宝快捷支付", // 支付说明
  359. // payType: "alipay", // 支付类型
  360. // payStatus: 0, // 支付状态(1-可用,0-不可用)
  361. // payChannel: "appAliPay",
  362. // },
  363. {
  364. name: "微信支付",
  365. icon: "icon-wechat",
  366. value: "weixin",
  367. title: "微信快捷支付",
  368. payType: "weixin",
  369. payStatus: 0,
  370. payChannel: "routine",
  371. },
  372. // {
  373. // name: "余额支付",
  374. // icon: "icon-balance",
  375. // value: "yue",
  376. // title: "可用余额:",
  377. // payType: "yue",
  378. // payStatus: 1,
  379. // payChannel: "weixinh5",
  380. // },
  381. // {
  382. // name: "贝币支付",
  383. // icon: "icon-balance",
  384. // value: "yue",
  385. // title: "可用贝币:",
  386. // payType: "yue",
  387. // payStatus: 0,
  388. // payChannel: "weixinh5",
  389. // },
  390. ]);
  391. // 计算属性:过滤出可用的支付方式(只保留payStatus为1的项)
  392. const avaliablePayments = computed(() => {
  393. return payments.value.filter((item) => item.payStatus === 1);
  394. });
  395. // 响应式变量:当前选中的支付方式(默认余额支付)
  396. const payType = ref("alipay");
  397. // 响应式变量:优惠券打开方式(1表示"使用"场景)
  398. const openType = ref(1);
  399. // 响应式变量:当前选中的支付方式索引(用于UI高亮)
  400. const active = ref(0);
  401. // 响应式变量:优惠券相关配置(控制弹窗显示、列表数据等)
  402. const coupon = ref({
  403. coupon: false, // 是否显示优惠券弹窗
  404. list: [], // 优惠券列表数据
  405. statusTile: "立即使用", // 按钮文字
  406. });
  407. // 响应式变量:地址相关配置(控制弹窗显示、选中地址ID等)
  408. const address = ref({
  409. address: false,
  410. addressId: 0,
  411. }); // 地址组件
  412. const addressInfo = ref({}); // 地址信息
  413. const addressId = ref(0); // 地址id
  414. const couponId = ref(0); // 优惠券id
  415. const userInfo = ref({}); // 用户信息
  416. const mark = ref(""); // 备注信息
  417. const couponTitle = ref("请选择"); // 优惠券
  418. const useIntegral = ref(false); // 是否使用积分
  419. const status = ref(0);
  420. // 响应式变量:是否有地址(用于判断是否需要提示用户添加地址)
  421. const is_address = ref(false);
  422. // 响应式变量:支付页面刷新标识(修复支付页面隐藏后刷新问题)
  423. const toPay = ref(false);
  424. // 响应式变量:配送方式(0-快递配送,1-到店自提)
  425. const shippingType = ref(0);
  426. // 响应式变量:选中的门店信息(自提时使用)
  427. const system_store = ref({});
  428. const contacts = ref("");
  429. // 响应式变量:联系人电话(自提时可能需要)
  430. const contactsTel = ref("");
  431. const storeList = ref([]);
  432. // 响应式变量:是否支持门店自提(1-支持,0-不支持)
  433. const store_self_mention = ref(0);
  434. // 响应式变量:购物车商品信息(订单中的商品列表)
  435. const cartInfo = ref([]);
  436. const animated = ref(false);
  437. // 响应式变量:订单总价
  438. const totalPrice = ref(0);
  439. const pagesUrl = ref("");
  440. // const usableCoupon = ref({});
  441. const payChannel = ref("");
  442. // 响应式变量:订单信息详情(包含商品总价、运费、折扣等)
  443. const orderInfoVo = ref({});
  444. // 响应式变量:地址列表数据(用于地址选择组件)
  445. const addressList = ref([]);
  446. // 响应式变量:订单商品总数
  447. const orderProNum = ref(0);
  448. const preOrderNo = ref(""); // 预下单订单号
  449. const addressWindowRef = ref(null); // 地址组件引用
  450. const showCouponPopup = ref(false); // 显示优惠券弹窗
  451. const showModal = ref(false);
  452. const userSelectPayTypeItem = ref(null);
  453. const wechatPaymentRef = ref(null);
  454. // 监听 isLogin
  455. watch(
  456. () => appStore.isLogin, // 监听的数据源:全局登录状态
  457. (newV) => {
  458. // newV是登录状态的新值(true/false)
  459. if (newV) {
  460. // 若已登录
  461. getloadPreOrder(); // 加载预订单信息
  462. this.getaddressInfo(); // 获取地址信息(this指向当前组件实例)
  463. }
  464. },
  465. {
  466. deep: true,
  467. } // 深度监听(确保复杂数据类型变化也能触发)
  468. );
  469. // 商品总价
  470. // 页面加载时触发的生命周期函数
  471. onLoad((options) => {
  472. // options是页面跳转时传递的参数
  473. console.log(appStore.userInfo); // 打印用户信息(调试用)
  474. // #ifdef APP
  475. // 支付宝沙箱模式(测试环境用,正式环境注释)
  476. // var EnvUtils = plus.android.importClass("com.alipay.sdk.app.EnvUtils");
  477. // EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
  478. // #endif
  479. // #ifdef H5
  480. payChannel.value = "weixinh5"; // H5环境支付渠道为微信H5支付
  481. // #endif
  482. // #ifdef APP
  483. payChannel.value = "appAliPay"; // APP环境支付渠道为支付宝APP支付
  484. // #endif
  485. // 从参数中获取预订单号(若没有则默认为0)
  486. preOrderNo.value = options.preOrderNo || 0;
  487. // 从参数中获取地址ID(若没有则默认为0)
  488. addressId.value = options.addressId || 0;
  489. // 从参数中获取是否有地址的标识
  490. is_address.value = options.is_address ? true : false;
  491. // 若已登录,则加载预订单信息;否则跳转到登录页
  492. if (appStore.isLogin) {
  493. getloadPreOrder(); // 加载预订单
  494. } else {
  495. toLogin(); // 跳登录
  496. }
  497. });
  498. // 组件挂载后触发的生命周期函数(DOM渲染完成后)
  499. onMounted(() => {
  500. textareaStatus.value = true; // 默认显示备注输入框
  501. // 若已登录且非支付页面,则获取地址信息(注释掉的逻辑,预留)
  502. if (appStore.isLogin && !toPay.value) {
  503. //this.getaddressInfo();
  504. }
  505. // 监听全局事件"handClick"(用于接收门店选择结果)
  506. uni.$on("handClick", (res) => {
  507. if (res) {
  508. // 若有结果
  509. system_store.value = res.address; // 更新选中的门店信息
  510. }
  511. // 清除监听(避免重复触发)
  512. uni.$off("handClick");
  513. });
  514. });
  515. // 是否选择余料支付
  516. const useGoldPay = (e) => {
  517. computedPrice();
  518. };
  519. const metalTypeMap = {
  520. 1: {
  521. name: "黄金",
  522. balance: 0,
  523. },
  524. 2: {
  525. name: "铂金",
  526. balance: 0,
  527. },
  528. 3: {
  529. name: "白银",
  530. balance: 0,
  531. },
  532. };
  533. const metalType = ref(1);
  534. // 加载预订单信息(核心函数:初始化订单数据)
  535. const getloadPreOrder = () => {
  536. // 调用加载预订单API,传入预订单号
  537. loadPreOrderApi(preOrderNo.value)
  538. .then((res) => {
  539. metalTypeMap[1].balance = res.data.auBalance || 0;
  540. metalTypeMap[2].balance = res.data.ptBalance || 0;
  541. metalTypeMap[3].balance = res.data.agBalance || 0;
  542. metalType.value = res.data.metalType || 1;
  543. // 接口成功回调
  544. let orderInfoVoData = res.data.orderInfoVo; // 订单基本信息
  545. orderInfoVo.value = orderInfoVoData; // 保存订单信息
  546. cartInfo.value = orderInfoVoData.orderDetailList; // 保存商品列表
  547. orderProNum.value = orderInfoVoData.orderProNum; // 保存商品总数
  548. // 设置地址ID(优先用参数传入的,没有则用订单默认的)
  549. address.value.addressId = addressId.value
  550. ? addressId.value
  551. : orderInfoVoData.addressId;
  552. // 判断是否支持门店自提(根据接口返回和全局状态)
  553. store_self_mention.value =
  554. res.data.storeSelfMention == "true" && // 接口返回支持自提
  555. appStore.productTypeComputed === "normal" // 全局状态为普通商品
  556. ? true
  557. : false;
  558. // 根据商城类型设置是否使用积分(mallType=1时默认使用)
  559. useIntegral.value = orderInfoVo.value.mallType === 1;
  560. // 根据商城类型设置默认支付方式(mallType=1时用贝币支付)
  561. payType.value = "yue";
  562. // 动态更新支付方式状态(根据接口返回的配置)
  563. payments.value.forEach((item) => {
  564. if (orderInfoVo.value.mallType === 1) {
  565. // 贝币商城:只开放贝币支付
  566. item.title = "可用贝币: " + orderInfoVoData.userIntegral;
  567. item.payStatus = item.name === "贝币支付" ? 1 : 0;
  568. } else {
  569. // 普通商城:根据各支付方式状态分别处理
  570. if (item.name === "余额支付") {
  571. item.title = "可用余额: " + orderInfoVoData.userBalance;
  572. item.payStatus = parseInt(res.data.yuePayStatus) === 1 ? 1 : 0;
  573. } else if (item.payType === "weixin") {
  574. // 微信支付:状态由接口返回的payWeixinOpen决定
  575. item.payStatus = parseInt(res.data.payWeixinOpen) === 1 ? 1 : 0;
  576. } else if (item.name === "贝币支付") {
  577. item.payStatus = 0;
  578. }
  579. }
  580. });
  581. // 初始化默认选中第一个可用支付方式
  582. const firstAvailable = payments.value.find(
  583. (item) => item.payStatus === 1
  584. );
  585. if (firstAvailable) {
  586. const idx = avaliablePayments.value.indexOf(firstAvailable);
  587. active.value = idx >= 0 ? idx : 0;
  588. payType.value = firstAvailable.value;
  589. userSelectPayTypeItem.value = firstAvailable;
  590. }
  591. if (addressId.value) {
  592. computedPrice();
  593. }
  594. // 调用子页面方法授权后执行获取地址列表
  595. nextTick(() => {
  596. addressWindowRef.value.fetchAddressList();
  597. });
  598. })
  599. .catch((err) => {
  600. // 接口失败回调
  601. console.error(err); // 打印错误
  602. uni.navigateTo({
  603. url: "/pages/order_list/index",
  604. }); // 跳转到订单列表
  605. Toast({
  606. title: err,
  607. }); // 提示错误信息
  608. });
  609. };
  610. // 授权回调事件(用户授权后触发,预留)
  611. const onLoadFun = () => {
  612. //this.getaddressInfo(); // 获取地址信息(注释掉的逻辑)
  613. // 调用子组件方法获取地址列表(注释掉的逻辑)
  614. // this.$scope.selectComponent('#address-window').getAddressList();
  615. };
  616. // 获取门店列表数据(自提时使用)
  617. const getList = () => {
  618. // 从本地存储获取用户经纬度(用于附近门店查询)
  619. let longitude = uni.getStorageSync("user_longitude");
  620. let latitude = uni.getStorageSync("user_latitude");
  621. // 构造请求参数
  622. let data = {
  623. latitude: latitude, // 纬度
  624. longitude: longitude, // 经度
  625. page: 1, // 页码
  626. limit: 10, // 每页条数
  627. };
  628. // 调用门店列表API
  629. storeListApi(data)
  630. .then((res) => {
  631. // 成功回调
  632. let list = res.data.list || []; // 门店列表
  633. storeList.value = list; // 保存门店列表
  634. system_store.value = list[0]; // 默认选中第一个门店
  635. })
  636. .catch((err) => {
  637. // 失败回调
  638. Toast({
  639. title: err,
  640. }); // 提示错误
  641. });
  642. };
  643. // 关闭地址弹窗
  644. const changeClose = () => {
  645. address.value.address = false; // 隐藏地址弹窗
  646. };
  647. // 跳转门店列表页面(自提时选择门店)
  648. const showStoreList = () => {
  649. // 若有门店列表数据,则跳转到门店详情页
  650. if (storeList.value.length > 0) {
  651. uni.navigateTo({
  652. url: "/pages/users/goods_details_store/index",
  653. });
  654. }
  655. };
  656. // 计算订单价格
  657. function computedPrice() {
  658. let shippingTypeValue = shippingType.value;
  659. postOrderComputed({
  660. mallType: orderInfoVo.value.mallType, // 商城类型
  661. addressId: address.value.addressId, // 地址ID
  662. useIntegral: useIntegral.value ? true : false, // 是否用积分
  663. couponId: couponId.value, // 优惠券ID
  664. shippingType: parseInt(shippingTypeValue) + 1, // 配送方式(后端要求+1)
  665. preOrderNo: preOrderNo.value, // 预订单号
  666. goldNum: appStore.userInfo.goldBalance, // 余料数量
  667. })
  668. .then((res) => {
  669. // 成功回调
  670. let data = res.data; // 计算后的价格数据
  671. // 更新订单费用信息
  672. orderInfoVo.value.couponFee = data.couponFee; // 优惠券抵扣
  673. orderInfoVo.value.userIntegral = data.surplusIntegral; // 剩余积分
  674. orderInfoVo.value.deductionPrice = data.deductionPrice; // 积分抵扣金额
  675. orderInfoVo.value.freightFee = data.freightFee; // 运费
  676. orderInfoVo.value.payFee = data.payFee; // 实付金额
  677. orderInfoVo.value.proTotalFee = data.proTotalFee; // 商品总价
  678. orderInfoVo.value.useIntegral = data.useIntegral; // 是否使用积分
  679. orderInfoVo.value.usedIntegral = data.usedIntegral; // 已用积分
  680. orderInfoVo.value.surplusIntegral = data.surplusIntegral; // 剩余积分
  681. orderInfoVo.value.vipLevelDis = data.vipLevelDis; // 会员折扣
  682. })
  683. .catch((err) => {
  684. // 失败回调
  685. Toast({ title: err }); // 提示错误
  686. });
  687. }
  688. // 切换配送方式(快递/自提)
  689. const addressType = (e) => {
  690. let index = e; // 0-快递,1-自提
  691. shippingType.value = parseInt(index); // 更新配送方式
  692. // 若为普通商城类型,重新计算价格
  693. if (orderInfoVo.value.mallType === 0) {
  694. computedPrice();
  695. }
  696. // if (index == 1) getList();
  697. };
  698. // 配送方式选择器变化事件(预留,用于下拉选择器)
  699. const bindPickerChange = (e) => {
  700. let value = e.detail.value; // 选择的索引
  701. shippingType.value = value; // 更新配送方式
  702. computedPrice(); // 重新计算价格
  703. };
  704. // 关闭优惠券弹窗
  705. const closeCouponPopup = () => {
  706. showCouponPopup.value = false; // 隐藏优惠券弹窗
  707. };
  708. // 改变备注框状态(优惠券选择后调用)
  709. const changeTextareaStatus = () => {
  710. // 重置所有优惠券的选中状态
  711. for (let i = 0, len = coupon.value.list.length; i < len; i++) {
  712. coupon.value.list[i].use_title = "";
  713. coupon.value.list[i].is_use = 0;
  714. }
  715. textareaStatus.value = true; // 显示备注框
  716. status.value = 0; // 重置状态
  717. coupon.value.list = coupon.value.list; // 触发响应式更新
  718. };
  719. // 选择优惠券后的处理事件
  720. const ChangCoupons = (e) => {
  721. // this.usableCoupon = e
  722. // this.coupon.coupon = false
  723. let index = e,
  724. list = coupon.value.list,
  725. couponTitleValue = "请选择",
  726. couponIdValue = 0;
  727. console.log("list", list);
  728. for (let i = 0, len = list.length; i < len; i++) {
  729. if (i != index) {
  730. list[i].use_title = "";
  731. list[i].isUse = 0;
  732. }
  733. }
  734. // 切换当前优惠券的选中状态
  735. if (list[index].isUse) {
  736. // 若已选中,则取消选择
  737. list[index].use_title = "";
  738. list[index].isUse = 0;
  739. } else {
  740. // 若未选中,则选中
  741. list[index].use_title = "不使用"; // 显示"不使用"按钮
  742. list[index].isUse = 1; // 标记为选中
  743. couponTitleValue = list[index].name; // 更新标题为优惠券名称
  744. couponIdValue = list[index].id; // 更新选中的优惠券ID
  745. }
  746. // 更新优惠券相关状态
  747. couponTitle.value = couponTitleValue;
  748. couponId.value = couponIdValue;
  749. coupon.value.coupon = false;
  750. // coupon.value.list = list;
  751. computedPrice();
  752. };
  753. // 首次进入页面时展示默认地址
  754. const OnDefaultAddress = (e) => {
  755. addressInfo.value = e; // 保存默认地址详情
  756. address.value.addressId = e.id; // 更新选中地址ID
  757. };
  758. // 选择地址后触发的事件
  759. const OnChangeAddress = (e) => {
  760. console.log("OnChangeAddress", e);
  761. addressInfo.value = e;
  762. address.value.addressId = e.id;
  763. textareaStatus.value = true;
  764. //orderInfoVo.value.addressId = e;
  765. address.value.address = false;
  766. //this.getaddressInfo();
  767. if (orderInfoVo.value.mallType === 0) {
  768. computedPrice();
  769. }
  770. };
  771. // 备注输入事件(实时保存输入内容)
  772. const bindHideKeyboard = (e) => {
  773. mark.value = e.detail.value; // 保存输入的备注信息
  774. };
  775. // 获取当前订单可用的优惠券列表
  776. const getCouponList = () => {
  777. // 调用获取优惠券API,传入预订单号
  778. getUserAvailableCoupons({ scenePositionId: 1 }).then((res) => {
  779. coupon.value.list = res.data; // 保存优惠券列表
  780. openType.value = 1; // 设置打开方式为"使用"
  781. });
  782. };
  783. // 获取默认地址或指定地址详情
  784. const getaddressInfo = () => {
  785. if (addressId.value) {
  786. // 若有指定地址ID,获取该地址详情
  787. getAddressDetail(addressId.value).then((res) => {
  788. if (res.data) {
  789. // 若地址存在
  790. res.data.isDefault = parseInt(res.data.isDefault); // 转换默认地址标识为数字
  791. addressInfo.value = res.data || {}; // 保存地址详情
  792. addressId.value = res.data.id || 0; // 更新地址ID
  793. address.value.addressId = res.data.id || 0; // 更新选中地址ID
  794. }
  795. });
  796. } else {
  797. // 若没有指定地址ID,获取默认地址
  798. getAddressDefault().then((res) => {
  799. // 注意:原代码中未导入getAddressDefault,可能是遗漏
  800. if (res.data) {
  801. // 若默认地址存在
  802. res.data.isDefault = parseInt(res.data.isDefault);
  803. addressInfo.value = res.data || {};
  804. addressId.value = res.data.id || 0;
  805. address.value.addressId = res.data.id || 0;
  806. }
  807. });
  808. }
  809. };
  810. // 选择支付方式
  811. const payItem = (e) => {
  812. let activeValue = e;
  813. active.value = activeValue;
  814. animated.value = true;
  815. payType.value = avaliablePayments.value[activeValue].value;
  816. userSelectPayTypeItem.value = avaliablePayments.value[activeValue];
  817. computedPrice();
  818. setTimeout(() => {
  819. car();
  820. }, 500);
  821. };
  822. // 打开优惠券弹窗
  823. const couponTap = () => {
  824. // coupon.value.coupon = true;
  825. showCouponPopup.value = true;
  826. if (!coupon.value.list.length) getCouponList();
  827. // getCouponList();
  828. };
  829. // 关闭支付方式选择动画
  830. const car = () => {
  831. animated.value = false; // 关闭动画
  832. };
  833. // 打开地址选择弹窗
  834. const onAddress = () => {
  835. textareaStatus.value = false; // 隐藏备注框
  836. address.value.address = true; // 显示地址弹窗
  837. // 设置地址页面跳转链接(携带预订单号)
  838. pagesUrl.value =
  839. "/pages/users/user_address_list/index?preOrderNo=" + preOrderNo.value;
  840. };
  841. // 联系人输入事件(保存联系人)
  842. const realName = (e) => {
  843. contacts.value = e.detail.value;
  844. };
  845. // 联系人电话输入事件(保存电话)
  846. const phone = (e) => {
  847. contactsTel.value = e.detail.value;
  848. };
  849. // 创建订单并发起支付
  850. const payment = (data) => {
  851. // 调用创建订单API
  852. orderCreate(data)
  853. .then((res) => {
  854. appStore.SET_CART_REFRESH(true);
  855. // 订单创建成功
  856. // 调用支付流程,传入订单号和成功提示
  857. getOrderPay(res.data.orderNo, "支付成功");
  858. })
  859. .catch((err) => {
  860. // 订单创建失败
  861. console.error("payment error", err); // 打印错误
  862. uni.hideLoading(); // 隐藏加载中
  863. Toast({
  864. title: err,
  865. }); // 提示错误
  866. });
  867. };
  868. // 处理支付流程(根据支付类型发起支付并处理结果)
  869. const getOrderPay = async (orderNo, message) => {
  870. // 支付结果页地址(携带订单号)
  871. const goPages = "/pages/order_pay_status/index?order_id=" + orderNo;
  872. try {
  873. // 调用微信支付配置API(获取支付参数)
  874. // const res = await wechatOrderPay({
  875. // mallType: orderInfoVo.value.mallType,
  876. // orderNo: orderNo,
  877. // // payChannel: payChannel.value,
  878. // payChannel: userSelectPayTypeItem.value.payChannel,
  879. // payType: payType.value,
  880. // scene: appStore.productTypeComputed === "normal" ? 0 : 1177, // 下单时小程序的场景值
  881. // });
  882. // console.log("res-------------", res.data);
  883. switch (payType.value) {
  884. case "alipay":
  885. // 发起支付宝支付
  886. const result = await submitPayment({
  887. type: res.data.payType, // 支付类型
  888. orderInfo: res.data.alipayRequest, // 支付宝支付参数
  889. });
  890. console.log("result", result); // 打印支付结果
  891. // 失败提示信息(默认"支付失败")
  892. let failMsg = result?.message || paymentConfig.PAYMENT_STATUS.FAIL;
  893. // 根据支付结果处理
  894. if (result.status === paymentConfig.PAYMENT_STATUS.SUCCESS) {
  895. // 支付成功:查询后端支付状态
  896. const params = {
  897. orderNo: orderNo,
  898. payType: "alipay",
  899. };
  900. console.log("进入成功判断", params);
  901. const res = await alipayPaymentResult(params); // 调用查询接口
  902. console.log("alipayPaymentResult", res);
  903. // 提示成功并跳转到结果页
  904. return Toast(
  905. {
  906. title: paymentConfig.PAYMENT_STATUS.SUCCESS,
  907. icon: "success",
  908. },
  909. {
  910. tab: 4,
  911. url: goPages,
  912. }
  913. );
  914. } else if (result.status === paymentConfig.PAYMENT_STATUS.FAIL) {
  915. // 支付失败:提示并跳转
  916. return Toast(
  917. {
  918. title: paymentConfig.PAYMENT_STATUS.FAIL,
  919. },
  920. {
  921. tab: 5,
  922. url: `${goPages}&msg=${failMsg}`,
  923. }
  924. );
  925. } else if (result.status === paymentConfig.PAYMENT_STATUS.CANCEL) {
  926. // 支付取消:提示并跳转
  927. return Toast(
  928. {
  929. title: paymentConfig.PAYMENT_STATUS.CANCEL,
  930. },
  931. {
  932. tab: 5,
  933. url: `${goPages}&msg=${paymentConfig.PAYMENT_STATUS.CANCEL}`,
  934. }
  935. );
  936. }
  937. break;
  938. case "yue":
  939. // 余额支付:直接提示成功并跳转
  940. console.log("余额支付");
  941. return Toast(
  942. {
  943. title: message,
  944. },
  945. {
  946. tab: 5,
  947. url: goPages + "&status=1",
  948. }
  949. );
  950. break;
  951. case "weixin": {
  952. try {
  953. await wechatPaymentRef.value.createUniPay({
  954. amount: Number(orderInfoVo.value.payFee) * 100,
  955. description: `商品(¥${orderInfoVo.value.payFee})`,
  956. openId: appStore.$userInfo.openId,
  957. orderNo: orderNo,
  958. orderPrefix: "SHOP", // 订单号前缀(与公共组件generateCustomId匹配)
  959. /**
  960. * 回调2:支付成功(核心逻辑)
  961. * 作用:通知后端标记用户为SVIP,刷新用户状态
  962. */
  963. onUniPaySuccess: async (payStatusRes) => {
  964. try {
  965. return Toast(
  966. {
  967. title: "支付成功",
  968. icon: "success",
  969. },
  970. {
  971. tab: 4,
  972. url: goPages,
  973. }
  974. );
  975. } catch (err) {
  976. console.error("支付失败:", err);
  977. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  978. }
  979. },
  980. onUniPayCancel: () => {
  981. uni.showToast({ title: "用户取消支付", icon: "none" });
  982. return Toast(
  983. { title: WX_PAY_STATUS.CANCEL },
  984. {
  985. tab: 5,
  986. url: `${goPages}&msg=${WX_PAY_STATUS.CANCEL}`,
  987. }
  988. );
  989. },
  990. onUniPayFail: (err) => {
  991. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  992. return Toast(
  993. { title: WX_PAY_STATUS.FAIL },
  994. {
  995. tab: 5,
  996. url: `${goPages}&msg=${errMsg || WX_PAY_STATUS.FAIL}`,
  997. }
  998. );
  999. },
  1000. });
  1001. uni.hideLoading();
  1002. } catch (wxErr) {
  1003. uni.hideLoading();
  1004. const errMsg = wxErr?.errMsg || "";
  1005. if (errMsg.includes("cancel") || errMsg.includes("取消")) {
  1006. return Toast(
  1007. { title: WX_PAY_STATUS.CANCEL },
  1008. { tab: 5, url: `${goPages}&msg=${WX_PAY_STATUS.CANCEL}` }
  1009. );
  1010. }
  1011. return Toast(
  1012. { title: WX_PAY_STATUS.FAIL },
  1013. { tab: 5, url: `${goPages}&msg=${errMsg || WX_PAY_STATUS.FAIL}` }
  1014. );
  1015. }
  1016. }
  1017. }
  1018. uni.hideLoading(); // 隐藏加载中
  1019. } catch (error) {
  1020. // 支付过程出错
  1021. console.error("getOrderPay error", error, typeof error);
  1022. let msg = "";
  1023. // 处理错误信息
  1024. if (typeof error === "string") {
  1025. msg = error;
  1026. } else if (typeof error === "object" && error.message) {
  1027. msg = error.message;
  1028. } else {
  1029. msg = "支付失败,请稍后再试";
  1030. }
  1031. uni.hideLoading(); // 隐藏加载中
  1032. // 跳转到结果页并携带错误信息
  1033. uni.navigateTo({
  1034. url: `/pages/order_pay_status/index?order_id=${orderNo}&msg=${msg}`,
  1035. });
  1036. return Toast({
  1037. title: msg,
  1038. }); // 提示错误
  1039. }
  1040. };
  1041. function modalConfirm() {
  1042. showModal.value = false;
  1043. const webviewPageUrl = `/pages/webview/index?path=/pages/users/vault/rechargeRmb`;
  1044. uni.navigateTo({
  1045. url: webviewPageUrl,
  1046. fail: (err) => {
  1047. console.error("跳转到webview页面失败:", err);
  1048. uni.showToast({
  1049. title: "跳转失败,请重试",
  1050. icon: "none",
  1051. duration: 1500,
  1052. });
  1053. },
  1054. });
  1055. }
  1056. const SubOrder = async (e) => {
  1057. console.log("SubOrder", payType.value);
  1058. // return;
  1059. // if (payType.value == "alipay") {
  1060. // return Toast({ title: "暂不支持支付宝支付,请使用余额支付" });
  1061. // }
  1062. let data = {}; // 订单提交数据
  1063. // 验证:必须选择支付方式
  1064. if (!payType.value || !userSelectPayTypeItem.value)
  1065. return Toast({
  1066. title: "请选择支付方式",
  1067. });
  1068. // 验证:快递配送时必须选择地址
  1069. if (!address.value.addressId && !shippingType.value) {
  1070. return Toast({
  1071. title: "请选择收货地址",
  1072. });
  1073. }
  1074. // #ifdef APP
  1075. try {
  1076. const channels = await getAvailableChannels();
  1077. if (payType.value === "alipay" && !channels.includes("alipay")) {
  1078. return Toast({
  1079. title: "设备不支持支付宝支付",
  1080. });
  1081. }
  1082. } catch (error) {
  1083. console.error("获取支付渠道失败", error);
  1084. return Toast({
  1085. title: "获取支付渠道失败",
  1086. });
  1087. }
  1088. // #endif
  1089. // 构造订单提交数据
  1090. data = {
  1091. mallType: orderInfoVo.value.mallType,
  1092. realName: contacts.value,
  1093. phone: contactsTel.value,
  1094. addressId: address.value.addressId,
  1095. couponId: couponId.value,
  1096. payType: payType.value,
  1097. useIntegral: useIntegral.value,
  1098. preOrderNo: preOrderNo.value,
  1099. mark: mark.value,
  1100. // storeId: system_store.value.id || 0,
  1101. shippingType: util.$h.Add(shippingType.value, 1),
  1102. // payChannel: payChannel.value || "weixinh5",
  1103. payChannel: userSelectPayTypeItem.value.payChannel,
  1104. };
  1105. console.log(" data.payType", data.payType);
  1106. // 验证:贝币支付时余额是否充足
  1107. if (
  1108. orderInfoVo.value.mallType === 1 &&
  1109. Number(orderInfoVo.value.proTotalFee) > orderInfoVo.value.userIntegral
  1110. ) {
  1111. return Toast({
  1112. title: "贝币余额不足!",
  1113. });
  1114. }
  1115. // 验证:余额支付时余额是否充足
  1116. else if (
  1117. data.payType == "yue" &&
  1118. parseFloat(appStore.$userInfo.nowMoney) <
  1119. parseFloat(orderInfoVo.value.payFee)
  1120. ) {
  1121. // 余额不足
  1122. showModal.value = true;
  1123. return;
  1124. }
  1125. uni.showLoading({
  1126. title: "订单支付中",
  1127. });
  1128. // 发起支付
  1129. payment(data);
  1130. };
  1131. </script>
  1132. <style>
  1133. page {
  1134. background: #f9f7f0;
  1135. }
  1136. </style>
  1137. <style lang="scss" scoped>
  1138. .order-submission {
  1139. .order-submission-box {
  1140. padding: 16rpx;
  1141. }
  1142. .line {
  1143. width: 100%;
  1144. height: 3rpx;
  1145. image {
  1146. width: 100%;
  1147. height: 100%;
  1148. display: block;
  1149. }
  1150. }
  1151. .goods {
  1152. background-color: #fff;
  1153. padding: 16rpx;
  1154. border-radius: 16rpx;
  1155. margin-top: 20rpx;
  1156. }
  1157. .allAddress {
  1158. .nav {
  1159. width: 100%;
  1160. margin: 0 auto;
  1161. .item {
  1162. width: 334rpx;
  1163. &.on {
  1164. position: relative;
  1165. width: 230rpx;
  1166. &::before {
  1167. position: absolute;
  1168. bottom: 0;
  1169. content: "快递配送";
  1170. font-size: 28rpx;
  1171. display: block;
  1172. height: 0;
  1173. width: 336rpx;
  1174. border-width: 0 20rpx 80rpx 0;
  1175. border-style: none solid solid;
  1176. border-color: transparent transparent #fff;
  1177. z-index: 2;
  1178. border-radius: 14rpx 36rpx 0 0;
  1179. text-align: center;
  1180. line-height: 80rpx;
  1181. }
  1182. }
  1183. &:nth-of-type(2).on::before {
  1184. content: "到店自提";
  1185. border-width: 0 0 80rpx 20rpx;
  1186. border-radius: 36rpx 14rpx 0 0;
  1187. }
  1188. &.on2 {
  1189. position: relative;
  1190. &::before {
  1191. position: absolute;
  1192. bottom: 0;
  1193. content: "到店自提";
  1194. font-size: 28rpx;
  1195. display: block;
  1196. height: 0;
  1197. width: 401rpx;
  1198. border-width: 0 0 60rpx 60rpx;
  1199. border-style: none solid solid;
  1200. border-color: transparent transparent #f7c1bd;
  1201. border-radius: 36rpx 14rpx 0 0;
  1202. text-align: center;
  1203. line-height: 60rpx;
  1204. }
  1205. }
  1206. &:nth-of-type(1).on2::before {
  1207. content: "快递配送";
  1208. border-width: 0 60rpx 60rpx 0;
  1209. border-radius: 14rpx 36rpx 0 0;
  1210. }
  1211. }
  1212. }
  1213. .address {
  1214. width: 100%;
  1215. margin: 0 auto;
  1216. padding: 20rpx 20rpx 16rpx;
  1217. background-color: #fff;
  1218. box-sizing: border-box;
  1219. .addressCon {
  1220. width: 100%;
  1221. font-size: 26rpx;
  1222. color: #666;
  1223. .selected-address {
  1224. display: flex;
  1225. justify-content: flex-start;
  1226. align-items: start;
  1227. .default {
  1228. min-width: 64rpx;
  1229. padding: 0 8rpx;
  1230. height: 40rpx;
  1231. line-height: 40rpx;
  1232. text-align: center;
  1233. color: #333;
  1234. background-color: #f8c008;
  1235. border-radius: 8rpx;
  1236. font-size: 24rpx;
  1237. margin-right: 8rpx;
  1238. position: relative;
  1239. top: 5rpx;
  1240. }
  1241. }
  1242. .name {
  1243. font-size: 28rpx;
  1244. color: #666;
  1245. margin-top: 16rpx;
  1246. line-height: 44rpx;
  1247. .phone {
  1248. margin-left: 50rpx;
  1249. }
  1250. }
  1251. .default {
  1252. margin-right: 12rpx;
  1253. }
  1254. .setaddress {
  1255. color: #333;
  1256. font-size: 28rpx;
  1257. }
  1258. }
  1259. .iconfont {
  1260. font-size: 35rpx;
  1261. color: #707070;
  1262. }
  1263. }
  1264. .line {
  1265. width: 100%;
  1266. margin: 0 auto;
  1267. }
  1268. }
  1269. .pay-container {
  1270. .zf-box {
  1271. font-size: 32rpx;
  1272. color: #333;
  1273. font-weight: bold;
  1274. line-height: 48rpx;
  1275. margin: 16rpx 0;
  1276. }
  1277. .list {
  1278. background-color: #fff;
  1279. border-radius: 16rpx;
  1280. .payItem {
  1281. border-radius: 14rpx;
  1282. width: 100%;
  1283. font-size: 28rpx;
  1284. color: #282828;
  1285. height: 108rpx;
  1286. display: flex;
  1287. justify-content: space-between;
  1288. align-items: center;
  1289. padding: 0 16rpx;
  1290. .name {
  1291. text-align: center;
  1292. justify-content: flex-start;
  1293. .pay-icon {
  1294. width: 60rpx;
  1295. height: 60rpx;
  1296. margin-right: 10rpx;
  1297. }
  1298. }
  1299. .tip {
  1300. font-size: 24rpx;
  1301. color: #f8c008;
  1302. display: flex;
  1303. align-items: center;
  1304. justify-content: end;
  1305. .select-icon {
  1306. width: 28rpx;
  1307. height: 28rpx;
  1308. margin-left: 20rpx;
  1309. }
  1310. }
  1311. }
  1312. }
  1313. }
  1314. .wrapper {
  1315. background-color: #fff;
  1316. margin-top: 15rpx;
  1317. border-radius: 16rpx;
  1318. .item {
  1319. padding: 16rpx;
  1320. font-size: 28rpx;
  1321. color: #333333;
  1322. font-weight: bold;
  1323. // border-bottom: 1px solid #f5f5f5;
  1324. .zf-box {
  1325. display: flex;
  1326. justify-content: space-between;
  1327. align-items: center;
  1328. }
  1329. .swicth-box {
  1330. display: flex;
  1331. justify-content: space-between;
  1332. align-items: center;
  1333. border: 2rpx solid #eee;
  1334. height: 86rpx;
  1335. font-size: 28rpx;
  1336. padding: 0 0 0 12%;
  1337. box-sizing: border-box;
  1338. margin: 20rpx 0;
  1339. border-radius: 14rpx;
  1340. .lable-box {
  1341. display: flex;
  1342. align-items: center;
  1343. .iconfont {
  1344. width: 44rpx;
  1345. height: 44rpx;
  1346. border-radius: 50%;
  1347. text-align: center;
  1348. line-height: 44rpx;
  1349. background-color: #fe960f;
  1350. color: #fff;
  1351. font-size: 30rpx;
  1352. margin-right: 15rpx;
  1353. &.icon-touzijintiao1 {
  1354. background-color: #f0cb88;
  1355. }
  1356. }
  1357. .lable-icon {
  1358. display: flex;
  1359. flex-direction: column;
  1360. justify-content: center;
  1361. }
  1362. .value {
  1363. font-size: 20rpx;
  1364. color: #fe960f;
  1365. }
  1366. }
  1367. }
  1368. .discount {
  1369. font-size: 28rpx;
  1370. color: #333;
  1371. .iconfont {
  1372. color: #515151;
  1373. font-size: 30rpx;
  1374. margin-left: 15rpx;
  1375. }
  1376. .num {
  1377. font-size: 32rpx;
  1378. margin-right: 20rpx;
  1379. }
  1380. .placeholder {
  1381. color: #ccc;
  1382. }
  1383. }
  1384. .shipping {
  1385. font-size: 30rpx;
  1386. color: #999;
  1387. position: relative;
  1388. padding-right: 58rpx;
  1389. .iconfont {
  1390. font-size: 35rpx;
  1391. color: #707070;
  1392. position: absolute;
  1393. right: 0;
  1394. top: 50%;
  1395. transform: translateY(-50%);
  1396. margin-left: 30rpx;
  1397. }
  1398. }
  1399. textarea {
  1400. font-size: 28rpx;
  1401. background-color: #f9f7f0;
  1402. width: auto !important;
  1403. height: 264rpx;
  1404. border-radius: 16rpx;
  1405. margin-top: 16rpx;
  1406. padding: 16rpx;
  1407. box-sizing: border-box;
  1408. font-weight: 400;
  1409. }
  1410. .placeholder {
  1411. color: #999;
  1412. }
  1413. .list {
  1414. margin-top: 35rpx;
  1415. .payItem {
  1416. border: 1px solid #eee;
  1417. border-radius: 14rpx;
  1418. height: 86rpx;
  1419. width: 100%;
  1420. box-sizing: border-box;
  1421. margin-top: 20rpx;
  1422. font-size: 28rpx;
  1423. color: #282828;
  1424. &.on {
  1425. border-color: #fc5445;
  1426. color: $theme-color;
  1427. }
  1428. .name {
  1429. flex: 1;
  1430. // width: 50%;
  1431. text-align: center;
  1432. border-right: 1px solid #eee;
  1433. justify-content: flex-start;
  1434. padding: 0 0 0 12%;
  1435. .iconfont {
  1436. width: 44rpx;
  1437. height: 44rpx;
  1438. border-radius: 50%;
  1439. text-align: center;
  1440. line-height: 44rpx;
  1441. background-color: #fe960f;
  1442. color: #fff;
  1443. font-size: 30rpx;
  1444. margin-right: 15rpx;
  1445. &.icon-wechat {
  1446. background-color: #41b035;
  1447. }
  1448. &.icon-zhifubao {
  1449. background-color: #06b4fd;
  1450. }
  1451. }
  1452. }
  1453. .tip {
  1454. width: 49%;
  1455. text-align: center;
  1456. font-size: 26rpx;
  1457. color: #aaa;
  1458. }
  1459. }
  1460. }
  1461. }
  1462. }
  1463. .moneyList {
  1464. margin-top: 16rpx;
  1465. background-color: #fff;
  1466. padding: 16rpx;
  1467. border-radius: 16rpx;
  1468. .item {
  1469. font-size: 28rpx;
  1470. color: #282828;
  1471. & ~ .item {
  1472. margin-top: 20rpx;
  1473. }
  1474. .money {
  1475. color: #333;
  1476. font-weight: bold;
  1477. }
  1478. }
  1479. }
  1480. .kong {
  1481. height: calc(132rpx + constant(safe-area-inset-bottom));
  1482. height: calc(132rpx + env(safe-area-inset-bottom));
  1483. }
  1484. .footer {
  1485. display: flex;
  1486. align-items: center;
  1487. padding: 22rpx 32rpx calc(22rpx + constant(safe-area-inset-bottom));
  1488. padding: 22rpx 32rpx calc(22rpx + env(safe-area-inset-bottom));
  1489. position: fixed;
  1490. bottom: 0;
  1491. width: 100%;
  1492. background-color: #fff;
  1493. z-index: 100;
  1494. box-shadow: inset 0rpx 1rpx 0rpx 0rpx #f1f3f8;
  1495. .price {
  1496. font-size: 36rpx;
  1497. line-height: 44rpx;
  1498. font-weight: bold;
  1499. color: #fd5f3c;
  1500. }
  1501. .settlement {
  1502. font-size: 32rpx;
  1503. font-weight: bold;
  1504. color: #333;
  1505. width: 410rpx;
  1506. height: 88rpx;
  1507. background-color: #f8c008;
  1508. border-radius: 16rpx;
  1509. text-align: center;
  1510. line-height: 88rpx;
  1511. z-index: 100;
  1512. }
  1513. .transparent {
  1514. opacity: 0;
  1515. }
  1516. }
  1517. }
  1518. .line2 {
  1519. color: #333;
  1520. font-weight: bold;
  1521. font-size: 32rpx;
  1522. }
  1523. .textR {
  1524. text-align: right;
  1525. }
  1526. .line-item {
  1527. margin-top: 16rpx;
  1528. .item-label {
  1529. font-size: 28rpx;
  1530. line-height: 44rpx;
  1531. color: #333;
  1532. }
  1533. .discount {
  1534. font-size: 28rpx;
  1535. color: #333;
  1536. font-weight: bold;
  1537. display: flex;
  1538. align-items: center;
  1539. &.none {
  1540. color: #999;
  1541. font-weight: normal;
  1542. }
  1543. .rt-arr {
  1544. width: 32rpx;
  1545. height: 32rpx;
  1546. margin-left: 8rpx;
  1547. }
  1548. }
  1549. }
  1550. </style>