paintSure.vue 16 KB

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