paintSure.vue 15 KB

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