confirm.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="box">
  3. <view class="topBox"></view>
  4. <view class="yuanhu"></view>
  5. <view class="goodsBox">
  6. <view class="goodsBoxLeft">
  7. <image :src="goodsInfo.ImgList[0].url" mode="" v-if="goodsInfo.ImgList.length>1" class="hotGoodsLineImg"></image>
  8. <image src="../../static/timg/noimg.png" v-else class="hotGoodsLineImg" ></image>
  9. </view>
  10. <view class="goodsBoxRgiht">
  11. <view class="goodsName">{{goodsInfo.name}}</view>
  12. <view class="goodsBottom">
  13. <view class="goodsPrice"> <span class="goodsPrice1">¥</span> {{goodsInfo.salePrice?goodsInfo.salePrice:goodsInfo.scribingPrice}}</view>
  14. <view class="numJsbox">
  15. <view class="numJj" @click="calculation(1)">-</view>
  16. <view class="goodsnum">{{goodsnum}}</view>
  17. <view class="numJj" @click="calculation(2)">+</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="cont">
  23. <view class="contKk">
  24. <view class="contLine">
  25. <view class="contlineLeft">服务门店</view>
  26. <view class="contlineRight">{{shopName}}</view>
  27. </view>
  28. <view class="contLine">
  29. <view class="contlineLeft">车牌号</view>
  30. <view class="contlineRight">
  31. <span>{{carInfo.plateNumber}}</span>
  32. <image src="../../static/timg/icon_arrow_right.png" mode="" class="contlineRightJt"></image>
  33. </view>
  34. </view>
  35. <view class="contLine">
  36. <view class="contlineLeft">车型</view>
  37. <view class="contlineRight">
  38. <span class="carModel">{{carInfo.carModel}}</span>
  39. <image src="../../static/timg/icon_arrow_right.png" mode="" class="contlineRightJt"></image>
  40. </view>
  41. </view>
  42. <view class="contLine">
  43. <view class="contlineLeft">联系人</view>
  44. <view class="contlineRight">
  45. <input type="text" v-model="customerName" placeholder="请输入联系人姓名" class="contlineRightInput">
  46. </view>
  47. </view>
  48. <view class="contLine " style="border-bottom: none;">
  49. <view class="contlineLeft">手机号</view>
  50. <view class="contlineRight">
  51. <input type="text" v-model="mobilePhone" placeholder="请输入联系人手机号" class="contlineRightInput">
  52. </view>
  53. </view>
  54. </view>
  55. <view class="contKk" style="margin-top:20rpx;">
  56. <view class="contLine " style="border-bottom: none;">
  57. <view class="contlineLeft">订单备注</view>
  58. <view class="contlineRight">
  59. <input type="text" v-model="comment" placeholder="请输入" class="contlineRightInput2">
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view style="height:120rpx"></view>
  65. <view class="bottomBox">
  66. <view class="bottomLeft">
  67. <view class="bottomLeftLine">合计: <span>¥</span> <span class="bottomPrice">{{totalMoney}}</span> </view>
  68. <view class="bottomLeftLine2">总优惠:¥{{yhMoney}}</view>
  69. </view>
  70. <view class="bottomBtn" @click="submit">提交订单</view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. components: {
  77. },
  78. data() {
  79. return {
  80. userInfo:'',
  81. goodsnum:1,
  82. id:'',
  83. info:'',
  84. carInfo:'',
  85. shopID:'',
  86. shopName:'',
  87. goodsInfo:'',
  88. totalMoney:'',
  89. yhMoney:0,
  90. customerName:'',
  91. mobilePhone:'',
  92. comment:'',
  93. }
  94. },
  95. onLoad(opt) {
  96. this.shopID=opt.shopID;
  97. this.shopName=opt.shopName;
  98. this.carInfo=this.$store.state.carInfo;
  99. this.goodsnum=opt.itemQty;
  100. //console.log(this.carInfo)
  101. this.userInfo = uni.getStorageSync("userInfo");
  102. this.goodsInfo=uni.getStorageSync("goodsDetail");
  103. this.jsMoney()
  104. //this.openGoodsDetailById()
  105. /* var a=[
  106. {name:1},{name:2}
  107. ]
  108. var b=a.map(i=>i.name);
  109. console.log(b) */
  110. },
  111. methods: {
  112. submit(){
  113. var jsonArray = [];
  114. var obj={
  115. itemId:this.goodsInfo.id,
  116. itemName:this.goodsInfo.name,
  117. itemQty:this.goodsnum,
  118. salePrice:this.goodsInfo.salePrice,
  119. totalPrice:this.totalMoney
  120. }
  121. jsonArray.push(obj)
  122. //"bizType:1商品2项目3套餐
  123. var params={
  124. sheetType:this.goodsInfo.bizType,
  125. sheetContent:this.goodsInfo.name,
  126. customerName:this.customerName,
  127. mobilePhone:this.mobilePhone,
  128. plateNumber:this.carInfo.plateNumber,
  129. carModel:this.carInfo.carModel,
  130. totalMoney:this.totalMoney,
  131. shopId:this.shopID,
  132. comment:this.comment,
  133. sheetDetail:JSON.stringify(jsonArray)
  134. }
  135. uni.showLoading({
  136. title: '加载中'
  137. })
  138. this.$http('openMallOrder/submitOrder', params,'POST').then(res => {
  139. uni.hideLoading();
  140. if(res.code==0){
  141. uni.showToast({
  142. title: res.msg,
  143. icon: 'none',
  144. duration: 3000
  145. });
  146. }else{
  147. uni.showToast({
  148. title: res.msg,
  149. icon: 'none',
  150. duration: 3000
  151. });
  152. }
  153. })
  154. },
  155. openGoodsDetailById(){
  156. this.$http('openMall/openGoodsDetailById', {
  157. id:this.id
  158. },'GET').then(res => {
  159. this.info=res.data
  160. })
  161. },
  162. goINdex(){
  163. uni.switchTab({
  164. url:'../index/index'
  165. })
  166. },
  167. calculation(type){
  168. if(type==1){
  169. if(this.goodsnum>1){
  170. this.goodsnum--
  171. this.jsMoney()
  172. }
  173. }else{
  174. if(this.goodsInfo.oneQty>this.goodsnum){
  175. this.goodsnum++
  176. this.jsMoney()
  177. }
  178. }
  179. },
  180. jsMoney(){
  181. if(this.goodsInfo.salePrice){
  182. this.totalMoney=this.goodsInfo.salePrice*this.goodsnum;
  183. if(this.goodsInfo.scribingPrice){
  184. var wyh=this.goodsInfo.scribingPrice*this.goodsnum;
  185. this.yhMoney=wyh-this.totalMoney;
  186. this.yhMoney=this.yhMoney.tofixed(2)
  187. }else{
  188. this.yhMoney=0
  189. }
  190. this.totalMoney=this.totalMoney.tofixed(2)
  191. }else{
  192. this.totalMoney=this.goodsInfo.scribingPrice*this.goodsnum
  193. this.totalMoney=this.totalMoney.tofixed(2)
  194. this.yhMoney=0
  195. }
  196. }
  197. }
  198. }
  199. </script>
  200. <style scoped lang="less">
  201. .bottomBox{
  202. width: 750rpx;
  203. height: 120rpx;
  204. background: #FFFFFF;
  205. box-shadow: 0px -2px 10rpx 0px rgba(153,153,153,0.2000);
  206. display: flex;
  207. justify-content: space-between;
  208. position: fixed;
  209. left: 0;
  210. bottom: 0;
  211. }
  212. .bottomLeft{
  213. padding-top: 25rpx;
  214. padding-left: 30rpx;
  215. }
  216. .bottomLeftLine{
  217. color: #666666;
  218. font-size: 24rpx;
  219. }
  220. .bottomLeftLine span{
  221. color: #FF0000;
  222. }
  223. .bottomPrice{
  224. font-size: 32rpx;
  225. }
  226. .bottomLeftLine2{
  227. color: #999999;
  228. line-height: 33rpx;
  229. font-size: 24rpx;
  230. }
  231. .bottomBtn{
  232. width: 204rpx;
  233. height: 74rpx;
  234. background: #D53533;
  235. border-radius: 37rpx;
  236. text-align: center;
  237. line-height: 74rpx;
  238. color: #FFFFFF;
  239. font-size: 30rpx;
  240. margin-top: 23rpx;
  241. margin-right: 30rpx;
  242. }
  243. .cont{
  244. padding: 20rpx 24rpx;
  245. }
  246. .contKk{
  247. background: #FFFFFF;border-radius: 10rpx;
  248. padding: 0 20rpx;
  249. }
  250. .contLine{
  251. display: flex;
  252. justify-content: space-between;
  253. font-size: 28rpx;
  254. padding: 30rpx 0;
  255. border-bottom: 1px solid #EEEEEE;
  256. }
  257. .contlineLeft{
  258. color: #666666;
  259. line-height: 40rpx;
  260. }
  261. .carModel{
  262. width: 500rpx;
  263. display: inline-block;
  264. white-space: nowrap;
  265. overflow: hidden;
  266. text-overflow: ellipsis;
  267. }
  268. .contlineRight{
  269. color: #333333;
  270. line-height: 40rpx;
  271. white-space: nowrap;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. width: 450rpx;
  275. text-align: right;
  276. }
  277. .contlineRightInput{
  278. color: #333333;
  279. }
  280. .contlineRightJt{
  281. width: 12rpx;
  282. height: 20rpx;
  283. margin-left: 20rpx;
  284. margin-top: 10rpx;
  285. }
  286. .box{
  287. background: #F4F5F7;
  288. min-height: 100vh;
  289. }
  290. .topBox{
  291. height: 140rpx;
  292. background: #FF0000;
  293. width: 750rpx;
  294. }
  295. .yuanhu{
  296. width: 750rpx;
  297. height: 30rpx;
  298. background: #FF0000;
  299. border-radius: 0 0 100% 100%;
  300. }
  301. .goodsBox{
  302. width: 662rpx;
  303. height: 194rpx;
  304. background: #FFFFFF;
  305. border-radius: 16rpx;
  306. margin-left: 24rpx;
  307. margin-top: -100rpx;
  308. padding: 20rpx;
  309. display: flex;
  310. }
  311. .goodsBoxLeft{
  312. width: 208rpx;
  313. height: 194rpx;
  314. border-radius: 16rpx;
  315. border: 1px solid #EEEEEE;
  316. }
  317. .hotGoodsLineImg{
  318. width: 208rpx;
  319. height: 194rpx;
  320. }
  321. .goodsnum{
  322. width: 88rpx;
  323. height: 44rpx;
  324. background: #F4F5F7;
  325. line-height: 44rpx;
  326. text-align: center;
  327. font-weight: 500;
  328. color: #333333;
  329. font-size: 24rpx;
  330. margin: 0 4rpx;
  331. }
  332. .numJsbox{
  333. display: flex;
  334. }
  335. .numJj{
  336. width: 44rpx;
  337. height: 44rpx;
  338. background: #F4F5F7;
  339. border-radius: 0px 6rpx 6rpx 0px;
  340. text-align: center;
  341. line-height: 44rpx;
  342. font-size: 30rpx;
  343. color: #F4F5F7;
  344. }
  345. .goodsnum{
  346. width: 88rpx;
  347. height: 44rpx;
  348. background: #F4F5F7;
  349. line-height: 44rpx;
  350. text-align: center;
  351. font-weight: 500;
  352. color: #333333;
  353. font-size: 24rpx;
  354. margin: 0 4rpx;
  355. }
  356. .goodsBottom{
  357. display: flex;
  358. justify-content: space-between;
  359. padding-top: 60rpx;
  360. }
  361. .goodsPrice{
  362. color: #333333;
  363. font-size: 32rpx;
  364. }
  365. .goodsPrice1{
  366. color: #333333;
  367. font-size: 22rpx;
  368. }
  369. .goodsName{
  370. font-weight: 400;
  371. color: #333333;
  372. line-height: 40rpx;
  373. font-size: 28rpx;
  374. height: 80rpx;
  375. text-overflow: -o-ellipsis-lastline;
  376. overflow: hidden;
  377. text-overflow: ellipsis;
  378. display: -webkit-box;
  379. -webkit-line-clamp: 2;
  380. line-clamp: 2;
  381. -webkit-box-orient: vertical;
  382. width: 420rpx;
  383. }
  384. .goodsBoxRgiht{
  385. padding-left: 24rpx;
  386. }
  387. </style>