paintSure.vue 15 KB

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