goodsDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <view class="box">
  3. <view v-if="goodsData">
  4. <view class="mainTop">
  5. <view class="imgBox">
  6. <swiper class="swiper" :circular="true"swiper-item
  7. :indicator-dots="true" indicator-active-color="#FF4F00"
  8. >
  9. <swiper-item v-for="(item,index) in goodsData.listImg">
  10. <view class="swiper-item">
  11. <image :src="item.url" mode="aspectFit" class="goodsImg" v-if="item.url"></image>
  12. <image src="../../static/img/noimg.png" mode="widthFix" class="goodsImg" v-else></image>
  13. </view>
  14. </swiper-item>
  15. <swiper-item v-if=" goodsData.listImg.length==0">
  16. <image src="../../static/img/noimg.png" mode="widthFix" class="goodsImg" ></image>
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. <view class="priceBox">
  21. <span class="price1">¥ <span v-if="goodsData.salePrice"> {{goodsData.salePrice}}</span>
  22. <span v-else> - </span>
  23. </span>
  24. </view>
  25. <view class="goodsName">
  26. {{goodsData.ShowName}}
  27. </view>
  28. </view>
  29. <!-- 已选车辆店铺-->
  30. <!-- 购物流程-->
  31. <view class="buyLc">
  32. <view class="title">购物流程</view>
  33. <view class="lcIMgBox">
  34. <image src="../../static/img/icon_liuc.png" mode="" class="lcImg"></image>
  35. </view>
  36. <view class="lcLineBox">
  37. <view class="lcline">
  38. 选择商品/项目
  39. </view>
  40. <view class="lcline">
  41. 选择门店
  42. </view>
  43. <view class="lcline">
  44. 在线支付
  45. </view>
  46. <view class="lcline">
  47. 到店服务
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 购物流程-->
  52. <!-- 详情-->
  53. <view class="goosDetal" v-if="MiniAppContent">
  54. <view class="goodsDetalTitle">详情</view>
  55. <rich-text :nodes="MiniAppContent" style="font-size: 0px;"></rich-text>
  56. </view>
  57. <!-- 详情-->
  58. <view style="height: 150rpx;"></view>
  59. <!-- 无店的情况-->
  60. <!-- <view class="bottomNoshop" v-if="!shopData">
  61. <view class="bottomNoshopBtn" @click="gockShop">请先前往首页选择门店</view>
  62. </view> -->
  63. <!-- 立即购买-->
  64. <!-- <view class="buyBottom" v-if="maintain!=1&&maintain!=2">
  65. <view class="buyBottomLeftLine buyBottomLeftLine2" @click="call">
  66. <image src="../../static/img/heicall.png" mode="widthFix" class="callImg"></image>
  67. <view class="buyBottomLeftLineTxt">电话</view>
  68. </view>
  69. <view class="buyBottomLeftLine buyBottomLeftLine2 buyBottomLeftLine3" @click="addGoodsCollection">
  70. <image src="../../static/img/icon_xin_pre.png" mode="widthFix" class="callImg"v-if="goodsData.isCollection==1"></image>
  71. <image src="../../static/img/icon_xin.png" mode="widthFix" class="callImg" v-else></image>
  72. <view class="buyBottomLeftLineTxt" v-if="goodsData.isCollection==1" style="color: #FF4F00;">已收藏</view>
  73. <view class="buyBottomLeftLineTxt" v-else>收藏</view>
  74. </view>
  75. <view class="buyBtn" @click="buy" v-if="maintainCarData&&nobuy!=1">立即购买</view>
  76. </view>
  77. <view class="buyBottom" v-if="maintain==2">
  78. <view class="tihuanBtn" @click="tihuan">替换</view>
  79. </view> -->
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. data() {
  86. return {
  87. goodsId:'',
  88. ShowName:'',
  89. shopData:'',
  90. maintainCarData:'',
  91. goodsData:'',
  92. type:'',
  93. MiniAppContent:'',
  94. typeIndex:'',
  95. nobuy:2,
  96. maintain:'',
  97. goodsreplaceData:'',
  98. }
  99. },
  100. onLoad(opt) {
  101. this.ShowName=opt.ShowName;
  102. this.goodsId=opt.goodsId;
  103. this.shopData=uni.getStorageSync("shopData");
  104. this.maintainCarData=uni.getStorageSync("maintainCarData");
  105. if(opt.type){
  106. this.type=opt.type
  107. }
  108. if(opt.nobuy){
  109. this.nobuy=opt.nobuy
  110. }
  111. if(opt.maintain){
  112. this.maintain=opt.maintain
  113. if(this.maintain==2){
  114. this.goodsreplaceData=uni.getStorageSync("goodsreplaceData");
  115. }
  116. }
  117. this.typeIndex=opt.typeIndex;
  118. this.getData();
  119. //this.addGoodsFootprint()
  120. },
  121. onShow() {
  122. this.$common.isUserId()
  123. this.shopData=uni.getStorageSync("shopData");
  124. },
  125. methods: {
  126. tihuan(){
  127. var that=this;
  128. uni.setStorage({
  129. key: 'replaceData',
  130. data: that.goodsreplaceData,
  131. success: function () {
  132. uni.navigateBack({
  133. delta:2
  134. })
  135. }
  136. });
  137. },
  138. buy(){
  139. var arr=[];
  140. var obj={
  141. 'id':'',
  142. 'listGoodsAll':[],
  143. 'listItem':[],
  144. };
  145. var url=''
  146. if(this.goodsData.list.length>0){
  147. if(this.goodsData.list[0].url){
  148. url=this.goodsData.list[0].url
  149. }else{
  150. }
  151. }
  152. var ShowName=''
  153. if(this.goodsData.ShowName){
  154. ShowName=this.goodsData.ShowName
  155. }
  156. var goodsObj={
  157. goodsID:this.goodsData.ID,
  158. mItemID:'',
  159. mGoodsID:this.goodsData.miniId,
  160. salePrice:this.goodsData.MiniAppSalePrice,
  161. qty:1,
  162. goodsName:ShowName,
  163. picUrl:url
  164. }
  165. obj.listGoodsAll.push(goodsObj);
  166. arr.push(obj)
  167. console.log(arr)
  168. //return false
  169. uni.removeStorageSync('couponData');
  170. uni.navigateTo({
  171. url:'../module/confirmOrder?orderData='+JSON.stringify(arr)+'&currentMileage='+this.maintainCarData.milage
  172. })
  173. },
  174. gockShop(){
  175. uni.navigateTo({
  176. url:'../Shop/ckShop'
  177. })
  178. },
  179. call(){
  180. console.log(this.shopData.mobilePhone)
  181. if(this.shopData.mobilePhone){
  182. uni.makePhoneCall({
  183. phoneNumber: this.shopData.mobilePhone
  184. });
  185. }else{
  186. uni.showToast({
  187. title: '未设置电话',
  188. icon:'none',
  189. duration: 3000,
  190. });
  191. }
  192. },
  193. addGoodsCollection(){
  194. if(this.goodsData.isCollection==0){
  195. uni.showLoading({
  196. title: '加载中'
  197. })
  198. this.$http('miniAppMyBMemberCar/addGoodsCollection', {
  199. goodsId:this.goodsId,
  200. },'POST').then(res => {
  201. uni.hideLoading();
  202. if(res.code!=0){
  203. uni.showToast({
  204. title: res.msg,
  205. icon:'none',
  206. duration: 3000,
  207. });
  208. }else{
  209. uni.showToast({
  210. title: '收藏成功',
  211. icon:'none',
  212. duration: 3000,
  213. });
  214. this.goodsData.isCollection=1;
  215. }
  216. })
  217. }else{
  218. uni.showLoading({
  219. title: '加载中'
  220. })
  221. this.$http('miniAppMyBMemberCar/deleteBMemberGoods', {
  222. goodId:this.goodsId,
  223. },'POST').then(res => {
  224. uni.hideLoading();
  225. if(res.code!=0){
  226. uni.showToast({
  227. title: res.msg,
  228. icon:'none',
  229. duration: 3000,
  230. });
  231. }else{
  232. uni.showToast({
  233. title: '取消成功',
  234. icon:'none',
  235. duration: 3000,
  236. });
  237. this.goodsData.isCollection=0;
  238. }
  239. })
  240. }
  241. },
  242. getData(){
  243. if(this.type==2){
  244. var params={
  245. goodsId:this.goodsId,
  246. //shopId:this.shopData.shopId,
  247. }
  248. }else{
  249. var location = uni.getStorageSync("locationCity");
  250. var params={
  251. id:this.goodsId,
  252. guidePrice:this.maintainCarData.guidePrice,
  253. cityCode:location.cityCode,
  254. // shopId:this.shopData.shopId,
  255. }
  256. }
  257. uni.showLoading({ });
  258. if( this.typeIndex==1){
  259. var url='miniApp/tPackageMiniAppController/queryGoodsMiniAppList'
  260. }else{
  261. var url='miniApp/tPackageMiniAppController/queryGoodsInfoDetail'
  262. }
  263. this.$http(url, params,'GET').then(res => {
  264. uni.hideLoading();
  265. /* var a=res.data.Items
  266. this.phoneList=this.phoneList.concat(a); */
  267. if(res.data.MiniAppContent){
  268. this.MiniAppContent=res.data.MiniAppContent.replace(/\<p/gi, '<p style="display: inline-block"');
  269. }
  270. this.goodsData=res.data;
  271. uni.setNavigationBarTitle({
  272. title: res.data.ShowName
  273. })
  274. })
  275. },
  276. addGoodsFootprint(){
  277. this.$http('miniAppMyBMemberCar/addGoodsFootprint', {
  278. goodId:this.goodsId,
  279. },'POST').then(res => {
  280. })
  281. }
  282. },
  283. filters:{
  284. formatRichText(html) {
  285. },
  286. }
  287. }
  288. </script>
  289. <style scoped>
  290. .box{
  291. min-height: 100vh;
  292. background:#F4F5F7 ;
  293. }
  294. .mainTop{
  295. background: #FFFFFF;
  296. }
  297. .swiper-item{
  298. width: 100vw;
  299. height: 700rpx;
  300. }
  301. .swiper{
  302. height: 700rpx;
  303. }
  304. .goodsImg{
  305. width: 750rpx;
  306. height: 700rpx;
  307. }
  308. .imgBox{
  309. text-align: center;
  310. }
  311. .priceBox{
  312. padding: 30rpx 17rpx;
  313. }
  314. .price1{
  315. font-size: 36rpx;
  316. font-weight: 600;
  317. color: #FF4F00;
  318. }
  319. .price2{
  320. font-size: 24rpx;
  321. color: #999999;
  322. padding-left: 20rpx;
  323. text-decoration:line-through;
  324. }
  325. .goodsName{
  326. padding: 0 25rpx 30rpx 25rpx;
  327. font-size: 32rpx;
  328. font-weight: 500;
  329. color: #333333;
  330. }
  331. .carShopBox{
  332. background: #FFFFFF;
  333. padding: 30rpx 24rpx;
  334. margin-top: 20rpx;
  335. }
  336. .maintainCarTitle{
  337. font-size: 26rpx;
  338. color: #999999;
  339. }
  340. .maintainCarTxt{
  341. font-size: 26rpx;
  342. color: #3C3C3C;
  343. padding-left: 30rpx;
  344. }
  345. .title{
  346. font-size: 30rpx;
  347. padding-bottom: 30rpx;
  348. color: #333333;
  349. font-weight: 600;
  350. }
  351. .shopBox{
  352. padding-top: 30rpx;
  353. display: flex;
  354. }
  355. .flex{
  356. display: flex;
  357. justify-content: space-between;
  358. }
  359. .shopCont{
  360. padding-left: 22rpx;
  361. width: 480rpx;
  362. }
  363. .shopName{
  364. color: #333333;
  365. font-size: 26rpx;
  366. font-weight: 600;
  367. }
  368. .span1{
  369. color: #FF4F00;font-size: 36rpx;
  370. }
  371. .span2{
  372. color: #FF4F00;font-size: 22rpx;
  373. }
  374. .span3{
  375. color: #333333;font-size: 22rpx;padding-left: 22rpx;
  376. }
  377. .shopBq{
  378. color: #FF4F00;font-size: 22rpx;border-radius: 4rpx;
  379. border: 1px solid #FF4F00;line-height: 30rpx;height: 30rpx;padding: 0rpx 5rpx;
  380. margin-top: 10rpx;
  381. }
  382. .shopTime{
  383. color: #666666;font-size: 22rpx;
  384. }
  385. .addressBox{
  386. color: #666666;font-size: 22rpx;
  387. }
  388. .shopImg{
  389. width: 120rpx;
  390. height: 120rpx;
  391. }
  392. .buyLc{
  393. padding: 24rpx 30rpx;
  394. background: #FFFFFF;
  395. margin-top: 20rpx;
  396. }
  397. .lcImg{
  398. width: 618rpx;
  399. height: 22rpx;
  400. }
  401. .lcIMgBox{
  402. text-align: center;
  403. }
  404. .lcline{
  405. font-size: 26rpx;
  406. color: #333333;
  407. }
  408. .lcLineBox{
  409. display: flex;
  410. justify-content: space-around;
  411. padding-top: 20rpx;
  412. }
  413. .goosDetal{
  414. background: #FFFFFF;
  415. margin-top: 20rpx;
  416. }
  417. .goodsDetalTitle{
  418. padding: 24rpx 30rpx;
  419. font-size: 30rpx;
  420. font-weight: 600;
  421. color: #333333;
  422. }
  423. .bottomNoshop{
  424. position: fixed;
  425. left: 0;
  426. bottom: 0;
  427. width: 750rpx;
  428. height: 120rpx;
  429. background: #FFFFFF;
  430. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  431. }
  432. .bottomNoshopBtn{
  433. width: 690rpx;
  434. height: 74rpx;
  435. background: #CCCCCC;
  436. border-radius: 37rpx;
  437. text-align: center;
  438. line-height: 74rpx;
  439. color: #FFFFFF;
  440. margin-top: 29rpx;
  441. margin-left: 30rpx;
  442. }
  443. .callImg{
  444. width: 36rpx;
  445. }
  446. .buyBottomLeftLineTxt{
  447. font-size: 22rpx;
  448. color: #333333;
  449. }
  450. .buyBottom{
  451. position: fixed;
  452. left: 0;
  453. bottom: 0;
  454. width: 750rpx;
  455. height: 120rpx;
  456. background: #FFFFFF;
  457. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  458. display: flex;
  459. }
  460. .buyBtn{
  461. width: 400rpx;
  462. height: 74rpx;
  463. background: #FF4F00;
  464. border-radius: 37rpx;
  465. text-align: center;
  466. line-height: 74rpx;
  467. font-size: 30rpx;
  468. color: #FFFFFF;
  469. margin-top: 23rpx;
  470. margin-left: 50rpx;
  471. }
  472. .buyBottomLeftLine1{
  473. padding-top: 28rpx;
  474. padding-left: 56rpx;
  475. }
  476. .buyBottomLeftLine2{
  477. padding-top: 32rpx;
  478. padding-left: 56rpx;
  479. text-align: center;
  480. }
  481. .buyBottomLeftLine3{
  482. width: 120rpx;
  483. padding-left: 0;
  484. margin-left: 50rpx;
  485. }
  486. .goosDetal /deep/ img{
  487. width: 100vw;
  488. }
  489. .goosDetal image{
  490. width: 100vw;
  491. }
  492. .goosDetal /deep/ p{
  493. margin: 0;
  494. padding: 0;
  495. display: flex;
  496. }
  497. .tihuanBtn{
  498. width: 600rpx;
  499. height: 74rpx;
  500. background: #FF4F00;
  501. border-radius: 37rpx;
  502. text-align: center;
  503. line-height: 74rpx;
  504. font-size: 30rpx;
  505. color: #FFFFFF;
  506. margin-top: 23rpx;
  507. margin-left: 75rpx;
  508. }
  509. </style>