paintSure.vue 14 KB

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