paintSure.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  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. <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" :style="{background:'#'+themeColor}" @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
  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
  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. }
  350. }
  351. });
  352. },
  353. openGoodsDetailById() {
  354. this.$http('openMall/openGoodsDetailById', {
  355. id: this.id
  356. }, 'GET').then(res => {
  357. this.info = res.data
  358. })
  359. },
  360. goINdex() {
  361. uni.switchTab({
  362. url: '../index/index'
  363. })
  364. },
  365. paintShopList() {
  366. uni.navigateTo({
  367. url: 'paintShopList'
  368. })
  369. },
  370. calculation(type) {
  371. if (type == 1) {
  372. if (this.goodsnum > 1) {
  373. this.goodsnum--
  374. this.jsMoney()
  375. }
  376. } else {
  377. if (this.goodsInfo.oneQty > this.goodsnum) {
  378. this.goodsnum++
  379. this.jsMoney()
  380. }
  381. }
  382. },
  383. jsMoney() {
  384. var money = 0.00
  385. this.itemList.forEach((item)=>{
  386. money += item.money
  387. })
  388. this.totalMoney = money.toFixed(2);
  389. }
  390. }
  391. }
  392. </script>
  393. <style scoped lang="less">
  394. .bottomBox {
  395. width: 750rpx;
  396. height: 120rpx;
  397. background: #FFFFFF;
  398. box-shadow: 0px -2px 10rpx 0px rgba(153, 153, 153, 0.2000);
  399. display: flex;
  400. justify-content: space-between;
  401. position: fixed;
  402. left: 0;
  403. bottom: 0;
  404. padding-bottom: constant(safe-area-inset-bottom);
  405. padding-bottom: env(safe-area-inset-bottom);
  406. }
  407. .bottomLeft {
  408. padding-top: 23rpx;
  409. padding-left: 30rpx;
  410. height: 74rpx;
  411. line-height: 74rpx;
  412. }
  413. .bottomLeftLine {
  414. color: #666666;
  415. font-size: 24rpx;
  416. }
  417. .bottomLeftLine span {
  418. color: #FF0000;
  419. }
  420. .bottomPrice {
  421. font-size: 32rpx;
  422. font-weight: 500;
  423. }
  424. .bottomLeftLine2 {
  425. color: #999999;
  426. line-height: 33rpx;
  427. font-size: 24rpx;
  428. }
  429. .bottomBtn {
  430. width: 204rpx;
  431. height: 74rpx;
  432. background: #D53533;
  433. border-radius: 37rpx;
  434. text-align: center;
  435. line-height: 74rpx;
  436. color: #FFFFFF;
  437. font-size: 30rpx;
  438. margin-top: 23rpx;
  439. margin-right: 30rpx;
  440. }
  441. .cont {
  442. padding: 20rpx 24rpx;
  443. }
  444. .contKk {
  445. background: #FFFFFF;
  446. border-radius: 10rpx;
  447. padding: 0 20rpx;
  448. }
  449. .detailedTitle {
  450. padding: 22rpx 0;
  451. display: flex;
  452. text-align: center;
  453. align-content: flex-start;
  454. font-size: 24rpx;
  455. font-weight: bold;
  456. color: #666666;
  457. }
  458. .contLine {
  459. display: flex;
  460. justify-content: space-between;
  461. font-size: 28rpx;
  462. padding: 30rpx 0;
  463. border-bottom: 1px solid #EEEEEE;
  464. }
  465. .contlineLeft {
  466. color: #666666;
  467. line-height: 40rpx;
  468. align-items: center;
  469. }
  470. .star {
  471. width: 14rpx;
  472. height: 14rpx;
  473. padding-bottom: 5rpx;
  474. }
  475. .carModel {
  476. width: 400rpx;
  477. display: inline-block;
  478. white-space: nowrap;
  479. overflow: hidden;
  480. text-overflow: ellipsis;
  481. }
  482. .noColor{
  483. color: #CCCCCC;
  484. }
  485. .carModelRight {
  486. display: flex;
  487. justify-content: flex-end;
  488. align-items: center;
  489. }
  490. .contlineRight {
  491. color: #333333;
  492. line-height: 40rpx;
  493. white-space: nowrap;
  494. overflow: hidden;
  495. text-overflow: ellipsis;
  496. width: 450rpx;
  497. text-align: right;
  498. }
  499. .selectBtn{
  500. width: 36rpx;
  501. height: 36rpx;
  502. }
  503. .contlineRightInput {
  504. color: #333333;
  505. }
  506. .contlineRightJt {
  507. width: 30rpx;
  508. height: 30rpx;
  509. }
  510. .box {
  511. background: #F4F5F7;
  512. min-height: 100vh;
  513. }
  514. .topBox {
  515. height: 140rpx;
  516. background: #FF0000;
  517. width: 750rpx;
  518. }
  519. .yuanhu {
  520. width: 750rpx;
  521. height: 30rpx;
  522. background: #FF0000;
  523. border-radius: 0 0 100% 100%;
  524. }
  525. .carBox {
  526. width: 662rpx;
  527. background: #FFFFFF;
  528. border-radius: 10rpx;
  529. margin-left: 24rpx;
  530. margin-top: -100rpx;
  531. padding: 20rpx;
  532. display: flex;
  533. }
  534. .left {
  535. margin-right: 24rpx;
  536. }
  537. .brandLogo {
  538. width: 72rpx;
  539. height: 72rpx;
  540. }
  541. .carPlate {
  542. height: 42rpx;
  543. font-size: 30rpx;
  544. font-weight: 500;
  545. color: #333333;
  546. line-height: 42rpx;
  547. }
  548. .car {
  549. width: 562rpx;
  550. height: 33rpx;
  551. font-size: 24rpx;
  552. font-weight: 400;
  553. color: #666666;
  554. line-height: 33rpx;
  555. margin-top: 10rpx;
  556. /* 隐藏文字显示 ...不换行 */
  557. overflow: hidden;
  558. text-overflow: ellipsis;
  559. white-space: nowrap;
  560. }
  561. .numJsbox {
  562. display: flex;
  563. }
  564. .numJj {
  565. width: 44rpx;
  566. height: 44rpx;
  567. background: #F4F5F7;
  568. border-radius: 0px 6rpx 6rpx 0px;
  569. text-align: center;
  570. line-height: 44rpx;
  571. font-size: 32rpx;
  572. color: #999999;
  573. }
  574. .goodsnum {
  575. width: 88rpx;
  576. height: 44rpx;
  577. background: #F4F5F7;
  578. line-height: 44rpx;
  579. text-align: center;
  580. font-weight: 500;
  581. color: #333333;
  582. font-size: 24rpx;
  583. margin: 0 4rpx;
  584. }
  585. .goodsBottom {
  586. display: flex;
  587. justify-content: space-between;
  588. padding-top: 60rpx;
  589. }
  590. .goodsPrice {
  591. color: #333333;
  592. font-size: 32rpx;
  593. font-weight: 500;
  594. }
  595. .goodsPrice1 {
  596. color: #333333;
  597. font-size: 22rpx;
  598. }
  599. .goodsName {
  600. font-weight: 400;
  601. color: #333333;
  602. line-height: 40rpx;
  603. font-size: 28rpx;
  604. height: 80rpx;
  605. text-overflow: -o-ellipsis-lastline;
  606. overflow: hidden;
  607. text-overflow: ellipsis;
  608. display: -webkit-box;
  609. -webkit-line-clamp: 2;
  610. line-clamp: 2;
  611. -webkit-box-orient: vertical;
  612. width: 420rpx;
  613. }
  614. .goodsBoxRgiht {
  615. padding-left: 24rpx;
  616. }
  617. .zhifuImg{
  618. width: 40rpx;
  619. height: 40rpx;
  620. margin-right: 20rpx;
  621. }
  622. .payLeft{
  623. display: flex;
  624. align-items: center;
  625. height: 40rpx;
  626. font-size: 28rpx;
  627. font-weight: 400;
  628. color: #333333;
  629. line-height: 40rpx;
  630. }
  631. </style>