Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

detail.vue 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <!-- <navBar title="产品详情"></navBar>
  3. <navBgCar></navBgCar> -->
  4. <view class="content-wrap">
  5. <view class="ul-item">
  6. <image style="width: 100%; height: 170rpx; background-color: #eeeeee"
  7. :src="`${$imgUrl}applyCard/product-bg.png`"></image>
  8. <view class="item-value">
  9. <image class="icon-tip" :src="`${$imgUrl}applyCard/wechat.png`"></image>
  10. <view class="content">
  11. <view class="title"> 微信车主服务 </view>
  12. <view style="margin-top: 15rpx" class="tip"> 先通行后付费! </view>
  13. </view>
  14. <view class="price">
  15. ¥<text style="font-size: 40rpx">99</text>.00
  16. </view>
  17. </view>
  18. </view>
  19. <view class="card-box">
  20. <view class="title"> 基础服务 </view>
  21. <view class="item-box">
  22. <view class=""> ETC设备与卡片 </view>
  23. <view class=""> 设备质保一年 </view>
  24. <view class=""> 开具通行费发票 </view>
  25. <view class=""> 高速通行9.5折 </view>
  26. </view>
  27. </view>
  28. <view class="radio">
  29. <view class="title"> 推荐加购权益 </view>
  30. <view class="radio-item">
  31. <image :src="`${$imgUrl}card-bg.png`" mode=""></image>
  32. <view class="radio-box">
  33. <view class="radio-box-left">
  34. <view class="icon">
  35. <image :src="`${$imgUrl}park.png`" mode=""></image>
  36. </view>
  37. <view class="content">
  38. <view class=""> 64元停车券 </view>
  39. <text>¥44.00</text>
  40. </view>
  41. </view>
  42. <view class="choose-item" @click="flag = 1">
  43. <view class="active" v-if="flag == 1"> </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="radio-item">
  48. <image :src="`${$imgUrl}card-bg.png`" mode=""></image>
  49. <view class="radio-box">
  50. <view class="radio-box-left">
  51. <view class="icon">
  52. <image :src="`${$imgUrl}car1.png`" mode=""></image>
  53. </view>
  54. <view class="content">
  55. <view class=""> 10次洗车券 </view>
  56. <text>¥44.00</text>
  57. </view>
  58. </view>
  59. <view class="choose-item" @click="flag = 2">
  60. <view class="active" v-if="flag == 2"> </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="more-btn">
  65. 查看更多<u-icon name="arrow-down"></u-icon>
  66. </view>
  67. </view>
  68. <view class="value-wrapper">
  69. <view class="flex">
  70. <view class="title"> 产品金额 </view>
  71. <view class="value">
  72. {{ "¥" + state.clientFee }}
  73. </view>
  74. </view>
  75. <view class="flex">
  76. <view class="title"> 加购权益 </view>
  77. <view class="value"> ¥0.00 </view>
  78. </view>
  79. <view class="flex">
  80. <view class="title"> 运费 </view>
  81. <view class="value"> ¥0.00 </view>
  82. </view>
  83. <view class="flex">
  84. <view class="title"> 优惠券 </view>
  85. <view class="value"> 暂无优惠券 </view>
  86. </view>
  87. <view class="flex">
  88. <view class="title"> 积分兑换 </view>
  89. <view class="value"> 暂无积分 </view>
  90. </view>
  91. <view class="flex">
  92. <view class="title"> 实付款 </view>
  93. <view class="money">
  94. {{ "¥" + state.clientFee }}
  95. </view>
  96. </view>
  97. </view>
  98. <view class="footer">
  99. <u-radio-group v-model="value">
  100. <u-radio shape="square">
  101. 阅读并同意<text>《用户授权协议》</text><text>《XXX隐私协议》</text>
  102. </u-radio>
  103. </u-radio-group>
  104. </view>
  105. <view class="action">
  106. <button type="default" class="button" @click="savaHandle()">
  107. {{ "确认办理:¥" + state.clientFee }}
  108. </button>
  109. </view>
  110. </view>
  111. </template>
  112. <script setup lang="ts">
  113. import { onLoad, onShow } from "@dcloudio/uni-app";
  114. import { reactive, ref } from "vue";
  115. import { etcQueryProduct, getOpenidApi } from "@/utils/network/api.js";
  116. import { request } from "@/utils/network/request.js";
  117. import { stringToJson } from "@/utils/network/encryption";
  118. import { fileURL } from "@/datas/fileURL.js";
  119. // import navBgCar from "./components/nav-bg-car5";
  120. // import navBar from "../../components/nav-bar/nav-bar2.vue"
  121. import { getItem, StorageKeys } from "@/utils/storage.ts";
  122. import {
  123. checkOrderStatus,
  124. wechatAppID,
  125. wechatPayConfigId,
  126. wechatSecret,
  127. } from "@/utils/network/api";
  128. import { confirm, msg } from "@/utils/utils";
  129. const imgURL = `${fileURL}image/`;
  130. const flag = ref(1);
  131. const savaHandle = () => {
  132. uni.redirectTo({
  133. url: "/subpackage/after-sale/to-bookkeeping-card/result",
  134. });
  135. };
  136. //获取微信小程序openid
  137. const getOpenID = () => {
  138. uni.login({
  139. provider: "weixin",
  140. success: function (e) {
  141. getOpenid(e.code)
  142. // uni.request({
  143. // url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  144. // success: (res: any) => {
  145. // state.openid = res.data.openid;
  146. // },
  147. // });
  148. },
  149. });
  150. };
  151. const getOpenid = (code) => {
  152. const options = {
  153. type: 2,
  154. data: {
  155. "jsCode": code
  156. },
  157. method: "POST",
  158. showLoading: true,
  159. };
  160. // #ifdef MP-WEIXIN
  161. request(getOpenidApi, options).then((res) => {
  162. const result = stringToJson(res.bizContent);
  163. console.log("获取微信小程序openid", result);
  164. // setItem("QYorder", result.data);
  165. const openidData = stringToJson(result.data);
  166. state.openid = openidData.openid
  167. });
  168. // #endif
  169. }
  170. //支付成功改变订单状态
  171. const checkOrder = () => {
  172. const options = {
  173. type: 2,
  174. data: {
  175. orderId: state.orderId,
  176. payConfigId: wechatPayConfigId,
  177. },
  178. method: "POST",
  179. showLoading: true,
  180. };
  181. request(checkOrderStatus, options).then((res) => {
  182. msg("支付成功!");
  183. var pages = getCurrentPages().length;
  184. uni.navigateBack({
  185. delta: pages,
  186. });
  187. });
  188. };
  189. onLoad((option : any) => {
  190. state.orderId = option.orderId;
  191. state.clientFee = option.clientFee / 100;
  192. getOpenID();
  193. });
  194. const state = reactive({
  195. openid: "",
  196. orderId: "",
  197. clientFee: undefined,
  198. });
  199. </script>
  200. <style lang="scss" scoped>
  201. .action {
  202. margin-top: 40rpx;
  203. padding-left: 20rpx;
  204. padding-right: 20rpx;
  205. padding-bottom: 30rpx;
  206. .button {
  207. height: 80rpx;
  208. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  209. border-radius: 40rpx;
  210. font-size: 32rpx;
  211. font-weight: 400;
  212. color: #ffffff;
  213. line-height: 80rpx;
  214. }
  215. }
  216. .footer {
  217. margin-top: 45rpx;
  218. text {
  219. color: #00b38b;
  220. }
  221. }
  222. .value-wrapper {
  223. margin-top: 40rpx;
  224. padding: 0rpx 30rpx;
  225. border-bottom: 1rpx solid #dcdcdc;
  226. .flex {
  227. padding: 20rpx 0rpx;
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. .title {
  232. font-size: 28rpx;
  233. font-family: Microsoft YaHei;
  234. font-weight: 400;
  235. color: #777777;
  236. line-height: 28rpx;
  237. }
  238. .value {
  239. font-size: 28rpx;
  240. font-family: Microsoft YaHei;
  241. font-weight: 400;
  242. color: #333333;
  243. line-height: 28rpx;
  244. }
  245. .money {
  246. font-size: 36rpx;
  247. font-family: Microsoft YaHei;
  248. font-weight: 400;
  249. color: #00b38b;
  250. line-height: 36rpx;
  251. }
  252. }
  253. }
  254. .content-wrap {
  255. position: relative;
  256. padding: 0rpx 30rpx;
  257. .ul-item {
  258. padding: 5px 0rpx;
  259. display: flex;
  260. align-items: center;
  261. .item-value {
  262. padding: 20rpx;
  263. position: absolute;
  264. display: flex;
  265. align-items: center;
  266. justify-content: space-around;
  267. .content {
  268. .title {
  269. font-size: 32rpx;
  270. font-family: Microsoft YaHei;
  271. font-weight: 400;
  272. color: #ffffff;
  273. }
  274. .tip {
  275. font-size: 24rpx;
  276. font-family: Microsoft YaHei;
  277. font-weight: 400;
  278. color: #ffffff;
  279. }
  280. }
  281. .price {
  282. margin-left: 180rpx;
  283. font-size: 25rpx;
  284. font-family: Microsoft YaHei;
  285. font-weight: 400;
  286. color: #ffffff;
  287. }
  288. }
  289. .icon-tip {
  290. width: 100rpx;
  291. height: 100rpx;
  292. }
  293. .content {
  294. margin-left: 40rpx;
  295. }
  296. }
  297. .card-box {
  298. .title {
  299. font-size: 30rpx;
  300. font-family: Microsoft YaHei;
  301. font-weight: 400;
  302. color: #333333;
  303. margin: 30rpx 0;
  304. }
  305. .item-box {
  306. display: flex;
  307. flex-wrap: wrap;
  308. view {
  309. background: #c1ffed;
  310. border: 1px solid #00b38b;
  311. border-radius: 30rpx;
  312. padding: 5rpx 15rpx;
  313. font-size: 28rpx;
  314. font-family: Microsoft YaHei;
  315. font-weight: 400;
  316. color: #019977;
  317. margin: 20rpx 30rpx;
  318. margin-top: 0;
  319. }
  320. }
  321. }
  322. .radio {
  323. .title {
  324. font-size: 30rpx;
  325. font-family: Microsoft YaHei;
  326. font-weight: 400;
  327. color: #333333;
  328. margin: 30rpx 0;
  329. }
  330. .more-btn {
  331. text-align: center;
  332. margin-top: 30rpx;
  333. border-bottom: 1rpx solid #dcdcdc;
  334. padding-bottom: 30rpx;
  335. font-size: 26rpx;
  336. font-family: Microsoft YaHei;
  337. font-weight: 400;
  338. color: #999999;
  339. }
  340. .radio-item {
  341. width: 100%;
  342. height: 150rpx;
  343. position: relative;
  344. image {
  345. width: 100%;
  346. height: 100%;
  347. position: absolute;
  348. z-index: -1;
  349. }
  350. .radio-box {
  351. // width: 100%;
  352. // height: 100%;
  353. display: flex;
  354. justify-content: space-between;
  355. align-items: center;
  356. padding: 30rpx;
  357. margin: 30rpx 0;
  358. .radio-box-left {
  359. display: flex;
  360. .icon {
  361. width: 88rpx;
  362. height: 88rpx;
  363. background: #89fcdb;
  364. border-radius: 50%;
  365. display: flex;
  366. justify-content: center;
  367. align-items: center;
  368. image {
  369. width: 48rpx;
  370. height: 48rpx;
  371. z-index: 1;
  372. }
  373. }
  374. .content {
  375. margin-left: 64rpx;
  376. view {
  377. font-size: 28rpx;
  378. font-family: Microsoft YaHei;
  379. font-weight: 400;
  380. color: #333333;
  381. margin-bottom: 10rpx;
  382. }
  383. text {
  384. font-size: 36rpx;
  385. font-family: Microsoft YaHei;
  386. font-weight: 400;
  387. color: #333333;
  388. }
  389. }
  390. }
  391. .choose-item {
  392. width: 44rpx;
  393. height: 44rpx;
  394. border: 2px solid #00b38b;
  395. border-radius: 50%;
  396. display: flex;
  397. justify-content: center;
  398. align-items: center;
  399. .active {
  400. width: 34rpx;
  401. height: 34rpx;
  402. background: #00b38b;
  403. border-radius: 50%;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. }
  410. </style>