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

product-detail.vue 11KB

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