選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

product-detail.vue 14KB

8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
9ヶ月前
8ヶ月前
8ヶ月前
1年前
1年前
8ヶ月前
1年前
8ヶ月前
8ヶ月前
8ヶ月前
1年前
1年前
8ヶ月前
1年前
11ヶ月前
8ヶ月前
8ヶ月前
11ヶ月前
9ヶ月前
1年前
8ヶ月前
1年前
9ヶ月前
8ヶ月前
1年前
1年前
1年前
1年前
1年前
8ヶ月前
2年前
1年前
8ヶ月前
9ヶ月前
9ヶ月前
8ヶ月前
9ヶ月前
5ヶ月前
5ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
8ヶ月前
2年前
2年前
2年前
8ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <navBar title="产品详情" navbgClass="nav-bgXin" fontColor='#fff'></navBar>
  3. <navBgCar :activeNum='5'></navBgCar>
  4. <view class="content-wrap">
  5. <view class="value-wrapper">
  6. <view class="flex" v-for="(item,index) in state.dataArray">
  7. <view class="title"> {{item.payName}} </view>
  8. <view class="value">
  9. <text class='unit'>¥</text>
  10. <text>{{item.fee * 0.01}}</text>
  11. </view>
  12. </view>
  13. <view class="flex">
  14. <view class="title"> 运费 </view>
  15. <view class="value"> <text class='unit'>¥</text><text>0.00</text> </view>
  16. </view>
  17. <view class="flex">
  18. <view class="title"> 实付款 </view>
  19. <view class="value">
  20. <text class='unit'>¥</text><text>{{ state.allMoney }}</text>
  21. </view>
  22. </view>
  23. <view class="as-layout-horizontal agreement" v-if="state.isSign">
  24. <checkbox-group @change="checkboxChange">
  25. <checkbox :checked="state.checked" style="transform: scale(0.65)" />
  26. <text class='txt'>我已阅读并同意</text>
  27. </checkbox-group>
  28. <text v-for="(item,index) in state.agreeURL" class="txt xieyi"
  29. @click="downAuthD(item)">《{{item.name}}》</text>
  30. </view>
  31. </view>
  32. <view class="action">
  33. <button type="default" class="button" @click="queryAgreement()">
  34. 确认办理
  35. </button>
  36. <!-- <button type="default" class="button" @click="sign()">
  37. 去签署协议
  38. </button> -->
  39. </view>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import {
  44. onLoad, onShow
  45. } from "@dcloudio/uni-app";
  46. import {
  47. reactive,
  48. ref
  49. } from "vue";
  50. import {
  51. getOpenId,
  52. envs, payQuery, agreementInSertOrder, agreeOrderProdcut, contractQuery, accountSign
  53. } from "@/utils/network/api.js";
  54. import { requestNew } from "@/utils/network/request.js";
  55. import {
  56. stringToJson
  57. } from "@/utils/network/encryption";
  58. import navBgCar from "./components/nav-bg-car1";
  59. import navBar from "@/components/nav-bar/nav-bar2.vue";
  60. import {
  61. msg, navTo
  62. } from "@/utils/utils";
  63. const savaHandle = () => {
  64. console.log("state.productId.length", state.productId.length, "111", state.typeScanCode)
  65. if (state.typeScanCode == 2) {
  66. console.log("233")
  67. // 扫码进来
  68. if (state.checked) {
  69. agreementConfirm().then((value) => {
  70. console.log("协议确认", value)
  71. msg("协议确认成功");
  72. })
  73. } else {
  74. msg("请勾选协议");
  75. }
  76. } else {
  77. console.log("state.checked", state.checked)
  78. if (state.checked) {
  79. agreementConfirm().then((value) => {
  80. console.log("协议确认", value)
  81. navTo(
  82. `/subpackage/orders/order_payment?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}&&isValueCard=${state.isValueCard}&vehicleId=${state.vehicleId}`,
  83. );
  84. })
  85. } else {
  86. msg("请勾选协议");
  87. }
  88. }
  89. };
  90. const downAuthD = (item) => {
  91. console.log('=======123', item)
  92. console.log("uni.env.USER_DATA_PATH '", uni.env.USER_DATA_PATH + '/' + '产品协议.docx')
  93. // 文件后缀截取
  94. // var index = item.url.lastIndexOf("\.");
  95. // let fileType = item.url.substring(index + 1, item.url.length);
  96. let arr = item.url.split(".");
  97. let fileType = arr[arr.length - 1];
  98. console.log("fileType", fileType)
  99. uni.downloadFile({
  100. url: item.url,
  101. // filePath: uni.env.USER_DATA_PATH + '/' + item.name + '.' + fileType,
  102. // uni.env.USER_DATA_PATH + '/' + item.name + '.' + fileType
  103. success(res) {
  104. console.log("文件下载返回数据:", res)
  105. const filePath = res.tempFilePath
  106. console.log("filePath", filePath)
  107. uni.openDocument({
  108. filePath: filePath,
  109. fileType: fileType,
  110. showMenu: true, //关键点
  111. success: function (res) {
  112. },
  113. fail: function (err) {
  114. msg("打开文档失败");
  115. }
  116. });
  117. },
  118. fail: function (err) {
  119. msg("下载文档失败");
  120. console.log("err", err)
  121. },
  122. complete(res) {
  123. }
  124. })
  125. }
  126. //获取微信小程序openid
  127. const getOpenID = () => {
  128. uni.login({
  129. provider: "weixin",
  130. success: function (e) {
  131. getOpenid(e.code);
  132. },
  133. });
  134. };
  135. const getOpenid = (code) => {
  136. const options = {
  137. type: 2,
  138. data: {
  139. "jsCode": code
  140. },
  141. method: "POST",
  142. showLoading: true,
  143. };
  144. // #ifdef MP-WEIXIN
  145. requestNew(getOpenId, options).then((res) => {
  146. const result = res;
  147. console.log("获取微信小程序openid", result);
  148. const openidData = stringToJson(result.bizContent);
  149. console.log("获取微信小程序openid====", openidData);
  150. state.openid = openidData.openid;
  151. refresh();
  152. });
  153. // #endif
  154. }
  155. // 协议确认接口
  156. const agreementConfirm = () => {
  157. const options = {
  158. type: 2,
  159. data: {
  160. orderId: state.orderId,
  161. protocol: state.checked ? 1 : 0,
  162. agreements: state.agreements
  163. },
  164. method: "POST",
  165. showLoading: true,
  166. };
  167. return new Promise(async (resolve, reject) => {
  168. const res = await requestNew(agreeOrderProdcut, options);
  169. const data = res;
  170. console.log("确认协议", data)
  171. resolve(data);
  172. }).catch((error) => {
  173. reject(error);
  174. });
  175. };
  176. onLoad((option : any) => {
  177. state.orderId = option.orderId;
  178. state.isValueCard = option.isValueCard;
  179. console.log("传递过来的参数", option)
  180. console.log("查协议", envs[process.env.NODE_ENV].baseUrl)
  181. state.id = option.id;
  182. state.vehicleId = option.vehicleId;
  183. getOpenID();
  184. if (option.typeScanCode) {
  185. state.typeScanCode = option.typeScanCode
  186. console.log("state.agreeURL", state.agreeURL)
  187. }
  188. // queryAgreement();
  189. });
  190. onShow(() => {
  191. contractRequest()
  192. })
  193. const state = reactive({
  194. openid: "",
  195. orderId: "",
  196. clientFee: undefined,
  197. id: "",
  198. options2: [{
  199. text: '删除',
  200. style: {
  201. backgroundColor: '#F56C6C'
  202. }
  203. }],
  204. list: [],
  205. productMoney: 0,
  206. allMoney: 0,
  207. productId: [],
  208. // 弹框
  209. type: 'center',
  210. msgType: 'success',
  211. messageText: '这是一条成功提示',
  212. value: '',
  213. detailsObj: '',
  214. isValueCard: "",
  215. dataArray: [],
  216. checked: false,
  217. agreeURL: [],
  218. typeScanCode: 0,//扫码进来得
  219. vehicleId: "",
  220. agreements: [],
  221. isSign: false
  222. });
  223. // 查协议
  224. const queryAgreement = () => {
  225. const options = {
  226. type: 2,
  227. data: {
  228. orderNo: state.orderId, //订单编号
  229. customerId: "",
  230. protocol: state.checked ? 1 : 0,
  231. },
  232. method: "POST",
  233. showLoading: true,
  234. };
  235. if (state.isSign) {
  236. if (state.checked) {
  237. requestNew(agreementInSertOrder, options).then((res) => {
  238. // agreementConfirm().then((value) => {
  239. // console.log("协议确认", value)
  240. navTo(
  241. `/subpackage/orders/order_payment?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}&&isValueCard=${state.isValueCard}&vehicleId=${state.vehicleId}`,
  242. );
  243. // })
  244. });
  245. } else {
  246. msg("请勾选协议");
  247. }
  248. } else {
  249. navTo(
  250. `/subpackage/orders/order_payment?orderId=${state.orderId}&&clientFee=${state.clientFee}&&id=${state.id}&&isValueCard=${state.isValueCard}&vehicleId=${state.vehicleId}`,
  251. );
  252. }
  253. }
  254. const checkboxChange = (e) => {
  255. state.checked = !state.checked;
  256. console.log(state.checked);
  257. };
  258. const refresh = () => {
  259. let source = ""
  260. // #ifdef MP-ALIPAY
  261. source = "ALI"
  262. // #endif
  263. // #ifdef MP-WEIXIN
  264. source = "WECHAT"
  265. // #endif
  266. var data = {
  267. orderNo: state.orderId,
  268. wxOpenId: state.openid,
  269. };
  270. const options = {
  271. type: 2,
  272. data: data,
  273. method: "POST",
  274. showLoading: true,
  275. };
  276. console.log("输出内容", options);
  277. requestNew(payQuery, options).then((res) => {
  278. const data = res
  279. console.log(data);
  280. if (data.paymentStatus == 'ALLSUCCESS') {
  281. state.allMoney = data.sumFee * 0.01
  282. return;
  283. }
  284. state.dataArray = data.datas;
  285. // HANDLE("办理费",1){},
  286. // MARGIN("保证金",2){},
  287. // PRESTORE("预存金",3){},
  288. // EQUITY("权益费",4){},
  289. for (let i = 0; i < state.dataArray.length; i++) {
  290. if (state.dataArray[i].payType === 'HANDLE') {
  291. state.dataArray[i].payName = '权益金'
  292. } else if (state.dataArray[i].payType === 'MARGIN') {
  293. state.dataArray[i].payName = '保证金'
  294. } else if (state.dataArray[i].payType === 'PRESTORE') {
  295. state.dataArray[i].payName = '预存金'
  296. } else if (state.dataArray[i].payType === 'EQUITY') {
  297. state.dataArray[i].payName = '权益费'
  298. } else {
  299. state.dataArray[i].payName = '未知费'
  300. }
  301. // SUCCESS("支付成功",1){},
  302. // PAYING("支付中",2){},
  303. // FAILED("支付失败",3){},
  304. // UNPAY("未支付",4){},
  305. // CLOSED("已关闭",5){},
  306. // CANCELED("已撤销",6){},
  307. // REFUND("转入退费",7){},
  308. if (state.dataArray[i].payStatus === 'SUCCESS') {
  309. state.dataArray[i].payStatusName = '已支付'
  310. } else if (state.dataArray[i].payStatus === 'PAYING') {
  311. state.dataArray[i].payStatusName = '支付中'
  312. } else if (state.dataArray[i].payStatus === 'FAILED') {
  313. state.dataArray[i].payStatusName = '支付失败'
  314. } else if (state.dataArray[i].payStatus === 'UNPAY') {
  315. state.dataArray[i].payStatusName = '未支付'
  316. } else if (state.dataArray[i].payStatus === 'CLOSED') {
  317. state.dataArray[i].payStatusName = '已关闭'
  318. } else if (state.dataArray[i].payStatus === 'CANCELED') {
  319. state.dataArray[i].payStatusName = '已撤销'
  320. } else if (state.dataArray[i].payStatus === 'REFUND') {
  321. state.dataArray[i].payStatusName = '转入退费'
  322. } else {
  323. state.dataArray[i].payStatusName = '未知'
  324. }
  325. state.allMoney += state.dataArray[i]["fee"] * 0.01
  326. }
  327. console.log("state.dataArray", state.dataArray)
  328. });
  329. }
  330. // 去签署协议
  331. const sign = () => {
  332. const options = {
  333. type: 2,
  334. data: {
  335. orderId: state.orderId, //订单编号
  336. },
  337. method: "POST",
  338. showLoading: true,
  339. };
  340. requestNew(accountSign, options).then((res) => {
  341. uni.navigateToMiniProgram({
  342. appId: 'wxeee4ac6e61915479',
  343. path: `/pages/externel/view/view?random=${res.random}&envType=product`,
  344. envVersion: 'release',
  345. fail: (error) => {
  346. console.log(error);
  347. }
  348. })
  349. console.log("去签署协议", res)
  350. });
  351. }
  352. // 查询是否签署协议
  353. const contractRequest = () => {
  354. const options = {
  355. type: 2,
  356. data: {
  357. orderNo: state.orderId, //订单编号
  358. },
  359. method: "POST",
  360. showLoading: true,
  361. };
  362. requestNew(contractQuery, options).then((res) => {
  363. if (res.flag) {
  364. state.isSign = true
  365. } else {
  366. state.isSign = false
  367. }
  368. console.log("查询是否签署协议", res)
  369. let data = res;
  370. let supAgreeArr = data.agreements;
  371. state.agreeURL = [];
  372. console.log("data==", supAgreeArr)
  373. for (var m = 0; m < supAgreeArr.length; m++) {
  374. let obj = {}
  375. for (let key in supAgreeArr[m]) {
  376. obj['name'] = key;
  377. obj['url'] = supAgreeArr[m][key];
  378. state.agreeURL.push(obj);
  379. }
  380. // obj['name'] = supAgreeArr[m]['name']
  381. // for (var k = 0; k < supAgreeArr[m]['address'].length; k++) {
  382. // state.agreements.push(supAgreeArr[m]['address'][k]['id'])
  383. // obj['url'] = envs[process.env.NODE_ENV].baseUrl + supAgreeArr[m]['address'][k]['url']
  384. // state.agreeURL.push(obj)
  385. // }
  386. }
  387. console.log("查协议", state.agreeURL, state.agreements)
  388. });
  389. }
  390. </script>
  391. <style lang="scss" scoped>
  392. .action {
  393. position: absolute;
  394. bottom: 0rpx;
  395. left: 0;
  396. height: 128rpx;
  397. background-color: #fff;
  398. border-radius: 30rpx 30rpx 0 0;
  399. width: 100vw;
  400. display: flex;
  401. align-items: center;
  402. justify-content: center;
  403. .button {
  404. height: 88rpx;
  405. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  406. border-radius: 40rpx;
  407. font-size: 32rpx;
  408. font-weight: 400;
  409. color: #ffffff;
  410. line-height: 88rpx;
  411. width: 660rpx;
  412. margin: 0 auto;
  413. }
  414. }
  415. .value-wrapper {
  416. background-color: #fff;
  417. padding: 40rpx 30rpx;
  418. border-radius: 12rpx;
  419. font-family: SourceHanSansCN, SourceHanSansCN;
  420. .flex {
  421. padding: 20rpx 0rpx;
  422. display: flex;
  423. justify-content: space-between;
  424. align-items: center;
  425. .title {
  426. font-size: 28rpx;
  427. font-weight: 400;
  428. line-height: 28rpx;
  429. color: #666666;
  430. }
  431. .value {
  432. font-size: 30rpx;
  433. font-family: Microsoft YaHei;
  434. font-weight: 400;
  435. line-height: 36rpx;
  436. color: #111111;
  437. .unit {
  438. margin-right: 4rpx;
  439. font-size: 22rpx;
  440. color: #111111;
  441. }
  442. }
  443. }
  444. }
  445. .content-wrap {
  446. position: absolute;
  447. top: 370rpx;
  448. width: 100%;
  449. min-height: calc(100% - 370rpx);
  450. box-sizing: border-box;
  451. padding: 0 30rpx 210rpx;
  452. .ul-item {
  453. padding: 5px 20rpx;
  454. display: flex;
  455. align-items: center;
  456. .item-value {
  457. padding: 20rpx;
  458. position: absolute;
  459. display: flex;
  460. align-items: center;
  461. // justify-content: space-around;
  462. width: 80%;
  463. .content {
  464. width: 48%;
  465. .title {
  466. font-size: 32rpx;
  467. font-family: Microsoft YaHei;
  468. font-weight: 400;
  469. color: #ffffff;
  470. }
  471. .tip {
  472. font-size: 24rpx;
  473. font-family: Microsoft YaHei;
  474. font-weight: 400;
  475. color: #ffffff;
  476. }
  477. }
  478. }
  479. .icon-tip {
  480. width: 100rpx;
  481. height: 100rpx;
  482. }
  483. .content {
  484. margin-left: 40rpx;
  485. }
  486. }
  487. }
  488. .del_item {
  489. background-color: rgb(41, 199, 207) !important;
  490. }
  491. .content-box {
  492. background-color: rgb(41, 199, 207);
  493. line-height: 80rpx;
  494. color: white;
  495. font-size: 32rpx;
  496. border-radius: 10rpx 0 0 10rpx;
  497. padding: 20rpx;
  498. box-sizing: border-box;
  499. }
  500. ::v-deep.uni-swipe_button-text {
  501. font-size: 30rpx !important;
  502. }
  503. ::v-deep.uni-swipe_button-group {
  504. font-size: 28rpx !important;
  505. }
  506. .add_all {
  507. width: 95%;
  508. margin: 0 auto;
  509. }
  510. .uni-swipe_box {
  511. margin-bottom: 16rpx !important;
  512. }
  513. ::v-deep.uni-swipe {
  514. margin-bottom: 16rpx !important;
  515. }
  516. .imageDefault {
  517. height: 40rpx;
  518. width: 40rpx;
  519. transform: rotate(270deg);
  520. margin-right: 12rpx;
  521. color: white;
  522. }
  523. .imageChange {
  524. height: 40rpx;
  525. width: 40rpx;
  526. transform: rotate(90deg);
  527. margin-right: 12rpx;
  528. color: white;
  529. }
  530. .price {
  531. color: white;
  532. }
  533. .agreement {
  534. font-size: 30rpx;
  535. display: flex;
  536. flex-wrap: wrap;
  537. margin-top: 20rpx;
  538. align-items: center;
  539. .txt {
  540. font-size: 24rpx;
  541. font-family: SourceHanSansCN, SourceHanSansCN;
  542. font-weight: 400;
  543. color: #111111;
  544. }
  545. .xieyi {
  546. color: #999;
  547. }
  548. }
  549. </style>