paintSure.vue 15 KB

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