paintSure.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <view class="box">
  3. <view class="topBox"></view>
  4. <view class="yuanhu"></view>
  5. <view class="carBox">
  6. <view class="left">
  7. <image :src="carInfo.brandLogo" mode="widthFix" class="brandLogo" v-if="carInfo.brandLogo">
  8. <img src="../../static/timg/nocar.png" alt="" class="brandLogo" v-else>
  9. </image>
  10. </view>
  11. <view class="right">
  12. <view class="carPlate">{{carInfo.plateNumber}}</view>
  13. <view class="car" v-if="carInfo.carModel">{{carInfo.carModel}}</view>
  14. <view class="car" v-else>暂无</view>
  15. </view>
  16. </view>
  17. <view class="cont">
  18. <view class="contKk">
  19. <view class="contLine">
  20. <view class="contlineLeft">联系人</view>
  21. <view class="contlineRight">
  22. <view class="contlineRight">{{customerName}}</view>
  23. </view>
  24. </view>
  25. <view class="contLine">
  26. <view class="contlineLeft">手机号</view>
  27. <view class="contlineRight">
  28. <view class="contlineRight">{{mobilePhone}}</view>
  29. </view>
  30. </view>
  31. <view class="contLine">
  32. <view class="contlineLeft">
  33. <image src="../../static/img/icon_star.png" mode="" class="star"></image>
  34. 服务门店
  35. </view>
  36. <view class="contlineRight carModelRight" @click="paintShopList">
  37. <span class="carModel" :class="{noColor:!shopInfo.shopName}">{{shopInfo.shopName?shopInfo.shopName:'选择服务门店'}}</span>
  38. <image src="../../static/img/little_rightArrow.png" mode="" class="contlineRightJt"></image>
  39. </view>
  40. </view>
  41. <view class="contLine">
  42. <view class="contlineLeft">
  43. <image src="../../static/img/icon_star.png" mode="" class="star"></image>
  44. 预约时间
  45. </view>
  46. <view class="contlineRight carModelRight" @click="cktime">
  47. <span class="carModel" :class="{noColor:!billDate}">{{billDate?billDate:'选择到店服务时间'}}</span>
  48. <image src="../../static/img/little_rightArrow.png" mode="" class="contlineRightJt"></image>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="contKk" style="margin-top:20rpx;">
  53. <view class="detailedTitle">支付方式</view>
  54. <view class="contLine " style="border-bottom: none;">
  55. <view class="payLeft" v-if="PayType==1">
  56. <image src="../../static/img/icon_weixinzhifu.png" mode="" class="zhifuImg"></image>
  57. 微信支付
  58. </view>
  59. <view class="payLeft" v-if="PayType==2">
  60. <image src="../../static/img/icon_xianxia.png" mode="" class="zhifuImg"></image>
  61. 线下支付
  62. </view>
  63. <!-- <view class="contlineRight">
  64. <image src="../../static/img/icon_selectN.png" mode="" class="selectBtn"></image>
  65. </view> -->
  66. </view>
  67. </view>
  68. </view>
  69. <view style="height:120rpx"></view>
  70. <view class="bottomBox">
  71. <view class="bottomLeft">
  72. <view class="bottomLeftLine">合计 <span>¥</span> <span class="bottomPrice">{{totalMoney}}</span> </view>
  73. </view>
  74. <view class="bottomBtn" @click="submit">提交订单</view>
  75. </view>
  76. <timeSelect ref="timeSelect" :timedata="timedata" @changeTime="changeTime"></timeSelect>
  77. </view>
  78. </template>
  79. <script>
  80. import timeSelect from '@/components/timeSelect/timeSelect.vue'
  81. export default {
  82. components: {
  83. timeSelect
  84. },
  85. data() {
  86. return {
  87. userInfo: '',
  88. goodsnum: 1,
  89. id: '',
  90. info: '',
  91. carInfo: '',
  92. shopInfo:{},
  93. goodsInfo: '',
  94. totalMoney: '',
  95. yhMoney: 0,
  96. customerName: '',
  97. mobilePhone: '',
  98. comment: '',
  99. mydata: '',
  100. orderData: '',
  101. PayType:0,
  102. timedata:'',
  103. billDate:'',
  104. itemList:[],
  105. sheetDetail:[],
  106. }
  107. },
  108. onLoad(opt) {
  109. this.itemList = JSON.parse(opt.itemList);
  110. console.log(this.itemList)
  111. this.itemList.forEach(item=>{
  112. var obj={
  113. itemId:item.id,
  114. itemName:item.name,
  115. itemQty:1,
  116. salePrice:item.money,
  117. totalPrice:item.money,
  118. }
  119. this.sheetDetail.push(obj)
  120. })
  121. this.goodsnum = opt.itemQty;
  122. //console.log(this.carInfo)
  123. this.userInfo = uni.getStorageSync("userInfo");
  124. this.goodsInfo = uni.getStorageSync("goodsDetail");
  125. this.jsMoney()
  126. //this.openGoodsDetailById()
  127. /* var a=[
  128. {name:1},{name:2}
  129. ]
  130. var b=a.map(i=>i.name);
  131. console.log(b) */
  132. this.$http('openreservation/getInfo', {
  133. lat: '',
  134. lng: '',
  135. }, 'GET').then(res => {
  136. this.mydata = res.data
  137. this.customerName = this.mydata.customerInfo.customerName
  138. this.mobilePhone = this.mydata.customerInfo.mobilePhone
  139. this.shopInfo = this.mydata.shopInfo
  140. this.shopID=this.shopInfo.id
  141. uni.setStorage({
  142. key: 'yyshopInfo',
  143. data:this.shopInfo,
  144. success: function () {
  145. }
  146. });
  147. console.log('默认服务门店-=',this.shopInfo)
  148. })
  149. this.$http('openSheetMetalSprayPaint/queryPayType', {
  150. }, 'GET').then(res => {
  151. this.PayType = res.data.PayType
  152. })
  153. },
  154. onShow() {
  155. this.carInfo = this.$store.state.carInfo;
  156. this.shopInfo=this.$store.state.ckshopInfo;
  157. this.shopInfo.id = this.shopInfo.shopId
  158. this.shopID=this.shopInfo.id
  159. uni.setStorage({
  160. key: 'yyshopInfo',
  161. data:this.shopInfo,
  162. success: function () {
  163. }
  164. });
  165. console.log('服务门店选择过-=',this.shopInfo)
  166. },
  167. methods: {
  168. changeTime(data){
  169. console.log(data)
  170. this.billDate=data
  171. },
  172. cktime(){
  173. this.$refs.timeSelect.open();
  174. },
  175. submit() {
  176. if (this.shopID == '') {
  177. uni.showToast({
  178. title: '请选择服务门店',
  179. icon: 'none',
  180. duration: 3000
  181. });
  182. return false;
  183. }
  184. if (this.billDate == '') {
  185. uni.showToast({
  186. title: '请选择到店服务时间',
  187. icon: 'none',
  188. duration: 3000
  189. });
  190. return false;
  191. }
  192. //"bizType:1商品2项目3套餐
  193. var params = {
  194. sheetType:'5',
  195. sheetContent: '钣喷',
  196. customerName: this.customerName,
  197. mobilePhone: this.mobilePhone,
  198. plateNumber: this.carInfo.plateNumber,
  199. carModel: this.carInfo.carModel,
  200. totalMoney: this.totalMoney,
  201. shopId: this.shopID,
  202. comment: this.comment,
  203. hTime: this.billDate,
  204. sheetDetail: JSON.stringify(this.sheetDetail),
  205. payType:this.PayType,
  206. }
  207. uni.showLoading({
  208. title: '加载中'
  209. })
  210. this.$http('openMallOrder/submitOrder', params, 'POST').then(res => {
  211. uni.hideLoading();
  212. if (res.code == 0) {
  213. this.orderData = res.data;
  214. if(this.PayType==1){
  215. this.unifiedPay(res.data)
  216. }else{
  217. uni.showToast({
  218. title: '提交成功',
  219. icon: 'none',
  220. duration: 2000
  221. });
  222. }
  223. } else {
  224. uni.showToast({
  225. title: res.msg,
  226. icon: 'none',
  227. duration: 3000
  228. });
  229. if (this.orderData.sheetType==5){
  230. uni.navigateTo({
  231. url: "../user/myOrder/paintOrderDetail?id=" +that.orderData.id
  232. })
  233. }
  234. }
  235. })
  236. },
  237. unifiedPay(res) {
  238. this.$http('openMallOrder/unifiedPay', {
  239. sheetId: res.id
  240. }, 'POST').then(res => {
  241. if (res.code == 0) {
  242. this.requestPayment(res.data)
  243. } else {
  244. uni.showToast({
  245. title: res.msg,
  246. icon: 'none',
  247. duration: 3000
  248. });
  249. }
  250. })
  251. },
  252. requestPayment(res) {
  253. var payInfo = res;
  254. //console.log(payInfo)
  255. //console.log(String(Date.now()))
  256. var that = this;
  257. uni.requestPayment({
  258. provider: 'wxpay',
  259. //timeStamp: String(Date.now()),
  260. timeStamp: payInfo.timeStamp,
  261. nonceStr: payInfo.nonceStr,
  262. package: payInfo.package,
  263. signType: payInfo.signType,
  264. paySign: payInfo.paySign,
  265. appid: payInfo.appId,
  266. /* provider: 'wxpay',
  267. orderInfo:{
  268. "appid":payInfo.appid, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  269. "noncestr": payInfo.nonceStr, // 随机字符串
  270. "package": "Sign=WXPay", // 固定值
  271. "partnerid":payInfo.mchId, // 微信支付商户号
  272. "prepayid": payInfo.prepayId, // 统一下单订单号
  273. "timeStamp": String(Date.now()), // 时间戳(单位:秒)
  274. "sign": payInfo.sign // 签名,这里用的 MD5/RSA 签名
  275. }, */
  276. success: function(res) {
  277. console.log('success:' + JSON.stringify(res));
  278. uni.showToast({
  279. title: '支付成功',
  280. icon: 'none',
  281. duration: 2000
  282. });
  283. if ((that.orderData.sheetType == 1) || (that.orderData.sheetType == 2) || (that
  284. .orderData.sheetType == 3)) {
  285. uni.redirectTo({
  286. url: "../user/myOrder/mallOrderDetail?id=" + that.orderData.id +
  287. "&SheetType=" + that.orderData.sheetType
  288. })
  289. }else if (that.orderData.sheetType==5){
  290. uni.navigateTo({
  291. url: "../user/myOrder/paintOrderDetail?id=" +that.orderData.id
  292. })
  293. }
  294. },
  295. fail: function(err) {
  296. console.log(err)
  297. uni.showToast({
  298. title: '支付失败',
  299. icon: 'none',
  300. duration: 2000
  301. });
  302. console.log(that.orderData)
  303. if (that.orderData.sheetType == 1 || that.orderData.sheetType == 2 || that.orderData
  304. .sheetType == 3) {
  305. console.log("商城订单s")
  306. uni.redirectTo({
  307. url: "../user/myOrder/mallOrderDetail?id=" + that.orderData.id +
  308. "&SheetType=" + that.orderData.sheetType
  309. })
  310. }else if (that.orderData.sheetType==5){
  311. uni.navigateTo({
  312. url: "../user/myOrder/paintOrderDetail?id=" +that.orderData.id
  313. })
  314. }
  315. }
  316. });
  317. },
  318. openGoodsDetailById() {
  319. this.$http('openMall/openGoodsDetailById', {
  320. id: this.id
  321. }, 'GET').then(res => {
  322. this.info = res.data
  323. })
  324. },
  325. goINdex() {
  326. uni.switchTab({
  327. url: '../index/index'
  328. })
  329. },
  330. paintShopList() {
  331. uni.navigateTo({
  332. url: 'paintShopList'
  333. })
  334. },
  335. calculation(type) {
  336. if (type == 1) {
  337. if (this.goodsnum > 1) {
  338. this.goodsnum--
  339. this.jsMoney()
  340. }
  341. } else {
  342. if (this.goodsInfo.oneQty > this.goodsnum) {
  343. this.goodsnum++
  344. this.jsMoney()
  345. }
  346. }
  347. },
  348. jsMoney() {
  349. var money = 0.00
  350. this.itemList.forEach((item)=>{
  351. money += item.money
  352. })
  353. this.totalMoney = money;
  354. // if (this.goodsInfo.salePrice) {
  355. // this.totalMoney = this.goodsInfo.salePrice * this.goodsnum;
  356. // if (this.goodsInfo.scribingPrice) {
  357. // var wyh = this.goodsInfo.scribingPrice * this.goodsnum;
  358. // this.yhMoney = wyh - this.totalMoney;
  359. // console.log(this.yhMoney)
  360. // this.yhMoney = this.yhMoney.toFixed(2)
  361. // } else {
  362. // this.yhMoney = 0
  363. // }
  364. // this.totalMoney = this.totalMoney.toFixed(2)
  365. // } else {
  366. // this.totalMoney = this.goodsInfo.scribingPrice * this.goodsnum
  367. // this.totalMoney = this.totalMoney.toFixed(2)
  368. // this.yhMoney = 0
  369. // }
  370. }
  371. }
  372. }
  373. </script>
  374. <style scoped lang="less">
  375. .bottomBox {
  376. width: 750rpx;
  377. height: 120rpx;
  378. background: #FFFFFF;
  379. box-shadow: 0px -2px 10rpx 0px rgba(153, 153, 153, 0.2000);
  380. display: flex;
  381. justify-content: space-between;
  382. position: fixed;
  383. left: 0;
  384. bottom: 0;
  385. padding-bottom: constant(safe-area-inset-bottom);
  386. padding-bottom: env(safe-area-inset-bottom);
  387. }
  388. .bottomLeft {
  389. padding-top: 23rpx;
  390. padding-left: 30rpx;
  391. }
  392. .bottomLeftLine {
  393. color: #666666;
  394. font-size: 24rpx;
  395. }
  396. .bottomLeftLine span {
  397. color: #FF0000;
  398. }
  399. .bottomPrice {
  400. font-size: 32rpx;
  401. font-weight: 500;
  402. }
  403. .bottomLeftLine2 {
  404. color: #999999;
  405. line-height: 33rpx;
  406. font-size: 24rpx;
  407. }
  408. .bottomBtn {
  409. width: 204rpx;
  410. height: 74rpx;
  411. background: #D53533;
  412. border-radius: 37rpx;
  413. text-align: center;
  414. line-height: 74rpx;
  415. color: #FFFFFF;
  416. font-size: 30rpx;
  417. margin-top: 23rpx;
  418. margin-right: 30rpx;
  419. }
  420. .cont {
  421. padding: 20rpx 24rpx;
  422. }
  423. .contKk {
  424. background: #FFFFFF;
  425. border-radius: 10rpx;
  426. padding: 0 20rpx;
  427. }
  428. .detailedTitle {
  429. padding: 22rpx 0;
  430. display: flex;
  431. text-align: center;
  432. align-content: flex-start;
  433. font-size: 30rpx;
  434. font-weight: bold;
  435. color: #3C3C3C;
  436. }
  437. .contLine {
  438. display: flex;
  439. justify-content: space-between;
  440. font-size: 28rpx;
  441. padding: 30rpx 0;
  442. border-bottom: 1px solid #EEEEEE;
  443. }
  444. .contlineLeft {
  445. color: #666666;
  446. line-height: 40rpx;
  447. align-items: center;
  448. }
  449. .star {
  450. width: 14rpx;
  451. height: 14rpx;
  452. padding-bottom: 5rpx;
  453. }
  454. .carModel {
  455. width: 400rpx;
  456. display: inline-block;
  457. white-space: nowrap;
  458. overflow: hidden;
  459. text-overflow: ellipsis;
  460. }
  461. .noColor{
  462. color: #CCCCCC;
  463. }
  464. .carModelRight {
  465. display: flex;
  466. justify-content: flex-end;
  467. align-items: center;
  468. }
  469. .contlineRight {
  470. color: #333333;
  471. line-height: 40rpx;
  472. white-space: nowrap;
  473. overflow: hidden;
  474. text-overflow: ellipsis;
  475. width: 450rpx;
  476. text-align: right;
  477. }
  478. .selectBtn{
  479. width: 36rpx;
  480. height: 36rpx;
  481. }
  482. .contlineRightInput {
  483. color: #333333;
  484. }
  485. .contlineRightJt {
  486. width: 30rpx;
  487. height: 30rpx;
  488. }
  489. .box {
  490. background: #F4F5F7;
  491. min-height: 100vh;
  492. }
  493. .topBox {
  494. height: 140rpx;
  495. background: #FF0000;
  496. width: 750rpx;
  497. }
  498. .yuanhu {
  499. width: 750rpx;
  500. height: 30rpx;
  501. background: #FF0000;
  502. border-radius: 0 0 100% 100%;
  503. }
  504. .carBox {
  505. width: 662rpx;
  506. background: #FFFFFF;
  507. border-radius: 10rpx;
  508. margin-left: 24rpx;
  509. margin-top: -100rpx;
  510. padding: 20rpx;
  511. display: flex;
  512. }
  513. .left {
  514. margin-right: 24rpx;
  515. }
  516. .brandLogo {
  517. width: 72rpx;
  518. height: 72rpx;
  519. }
  520. .carPlate {
  521. height: 42rpx;
  522. font-size: 30rpx;
  523. font-weight: 500;
  524. color: #333333;
  525. line-height: 42rpx;
  526. }
  527. .car {
  528. width: 562rpx;
  529. height: 33rpx;
  530. font-size: 24rpx;
  531. font-weight: 400;
  532. color: #666666;
  533. line-height: 33rpx;
  534. margin-top: 10rpx;
  535. /* 隐藏文字显示 ...不换行 */
  536. overflow: hidden;
  537. text-overflow: ellipsis;
  538. white-space: nowrap;
  539. }
  540. .numJsbox {
  541. display: flex;
  542. }
  543. .numJj {
  544. width: 44rpx;
  545. height: 44rpx;
  546. background: #F4F5F7;
  547. border-radius: 0px 6rpx 6rpx 0px;
  548. text-align: center;
  549. line-height: 44rpx;
  550. font-size: 32rpx;
  551. color: #999999;
  552. }
  553. .goodsnum {
  554. width: 88rpx;
  555. height: 44rpx;
  556. background: #F4F5F7;
  557. line-height: 44rpx;
  558. text-align: center;
  559. font-weight: 500;
  560. color: #333333;
  561. font-size: 24rpx;
  562. margin: 0 4rpx;
  563. }
  564. .goodsBottom {
  565. display: flex;
  566. justify-content: space-between;
  567. padding-top: 60rpx;
  568. }
  569. .goodsPrice {
  570. color: #333333;
  571. font-size: 32rpx;
  572. font-weight: 500;
  573. }
  574. .goodsPrice1 {
  575. color: #333333;
  576. font-size: 22rpx;
  577. }
  578. .goodsName {
  579. font-weight: 400;
  580. color: #333333;
  581. line-height: 40rpx;
  582. font-size: 28rpx;
  583. height: 80rpx;
  584. text-overflow: -o-ellipsis-lastline;
  585. overflow: hidden;
  586. text-overflow: ellipsis;
  587. display: -webkit-box;
  588. -webkit-line-clamp: 2;
  589. line-clamp: 2;
  590. -webkit-box-orient: vertical;
  591. width: 420rpx;
  592. }
  593. .goodsBoxRgiht {
  594. padding-left: 24rpx;
  595. }
  596. .zhifuImg{
  597. width: 40rpx;
  598. height: 40rpx;
  599. margin-right: 20rpx;
  600. }
  601. .payLeft{
  602. display: flex;
  603. align-items: center;
  604. height: 40rpx;
  605. font-size: 28rpx;
  606. font-weight: 400;
  607. color: #333333;
  608. line-height: 40rpx;
  609. }
  610. </style>