paintSure.vue 15 KB

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