paintSure.vue 16 KB

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