goodsDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  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. this.$http('miniAppMyBMemberCar/addGoodsCollection', {
  197. goodsId:this.goodsId,
  198. },'POST').then(res => {
  199. uni.hideLoading();
  200. if(res.code!=0){
  201. uni.showToast({
  202. title: res.msg,
  203. icon:'none',
  204. duration: 3000,
  205. });
  206. }else{
  207. uni.showToast({
  208. title: '收藏成功',
  209. icon:'none',
  210. duration: 3000,
  211. });
  212. this.goodsData.isCollection=1;
  213. }
  214. })
  215. }else{
  216. uni.showLoading({ });
  217. this.$http('miniAppMyBMemberCar/deleteBMemberGoods', {
  218. goodId:this.goodsId,
  219. },'POST').then(res => {
  220. uni.hideLoading();
  221. if(res.code!=0){
  222. uni.showToast({
  223. title: res.msg,
  224. icon:'none',
  225. duration: 3000,
  226. });
  227. }else{
  228. uni.showToast({
  229. title: '取消成功',
  230. icon:'none',
  231. duration: 3000,
  232. });
  233. this.goodsData.isCollection=0;
  234. }
  235. })
  236. }
  237. },
  238. getData(){
  239. if(this.type==2){
  240. var params={
  241. goodsId:this.goodsId,
  242. //shopId:this.shopData.shopId,
  243. }
  244. }else{
  245. var location = uni.getStorageSync("locationCity");
  246. var params={
  247. id:this.goodsId,
  248. guidePrice:this.maintainCarData.guidePrice,
  249. cityCode:location.cityCode,
  250. // shopId:this.shopData.shopId,
  251. }
  252. }
  253. uni.showLoading({ });
  254. if( this.typeIndex==1){
  255. var url='miniApp/tPackageMiniAppController/queryGoodsMiniAppList'
  256. }else{
  257. var url='miniApp/tPackageMiniAppController/queryGoodsInfoDetail'
  258. }
  259. this.$http(url, params,'GET').then(res => {
  260. uni.hideLoading();
  261. /* var a=res.data.Items
  262. this.phoneList=this.phoneList.concat(a); */
  263. if(res.data.MiniAppContent){
  264. this.MiniAppContent=res.data.MiniAppContent.replace(/\<p/gi, '<p style="display: inline-block"');
  265. }
  266. this.goodsData=res.data;
  267. uni.setNavigationBarTitle({
  268. title: res.data.ShowName
  269. })
  270. })
  271. },
  272. addGoodsFootprint(){
  273. this.$http('miniAppMyBMemberCar/addGoodsFootprint', {
  274. goodId:this.goodsId,
  275. },'POST').then(res => {
  276. })
  277. }
  278. },
  279. filters:{
  280. formatRichText(html) {
  281. },
  282. }
  283. }
  284. </script>
  285. <style scoped>
  286. .box{
  287. min-height: 100vh;
  288. background:#F4F5F7 ;
  289. }
  290. .mainTop{
  291. background: #FFFFFF;
  292. }
  293. .swiper-item{
  294. width: 100vw;
  295. height: 700rpx;
  296. }
  297. .swiper{
  298. height: 700rpx;
  299. }
  300. .goodsImg{
  301. width: 750rpx;
  302. height: 700rpx;
  303. }
  304. .imgBox{
  305. text-align: center;
  306. }
  307. .priceBox{
  308. padding: 30rpx 17rpx;
  309. }
  310. .price1{
  311. font-size: 36rpx;
  312. font-weight: 600;
  313. color: #FF4F00;
  314. }
  315. .price2{
  316. font-size: 24rpx;
  317. color: #999999;
  318. padding-left: 20rpx;
  319. text-decoration:line-through;
  320. }
  321. .goodsName{
  322. padding: 0 25rpx 30rpx 25rpx;
  323. font-size: 32rpx;
  324. font-weight: 500;
  325. color: #333333;
  326. }
  327. .carShopBox{
  328. background: #FFFFFF;
  329. padding: 30rpx 24rpx;
  330. margin-top: 20rpx;
  331. }
  332. .maintainCarTitle{
  333. font-size: 26rpx;
  334. color: #999999;
  335. }
  336. .maintainCarTxt{
  337. font-size: 26rpx;
  338. color: #3C3C3C;
  339. padding-left: 30rpx;
  340. }
  341. .title{
  342. font-size: 30rpx;
  343. padding-bottom: 30rpx;
  344. color: #333333;
  345. font-weight: 600;
  346. }
  347. .shopBox{
  348. padding-top: 30rpx;
  349. display: flex;
  350. }
  351. .flex{
  352. display: flex;
  353. justify-content: space-between;
  354. }
  355. .shopCont{
  356. padding-left: 22rpx;
  357. width: 480rpx;
  358. }
  359. .shopName{
  360. color: #333333;
  361. font-size: 26rpx;
  362. font-weight: 600;
  363. }
  364. .span1{
  365. color: #FF4F00;font-size: 36rpx;
  366. }
  367. .span2{
  368. color: #FF4F00;font-size: 22rpx;
  369. }
  370. .span3{
  371. color: #333333;font-size: 22rpx;padding-left: 22rpx;
  372. }
  373. .shopBq{
  374. color: #FF4F00;font-size: 22rpx;border-radius: 4rpx;
  375. border: 1px solid #FF4F00;line-height: 30rpx;height: 30rpx;padding: 0rpx 5rpx;
  376. margin-top: 10rpx;
  377. }
  378. .shopTime{
  379. color: #666666;font-size: 22rpx;
  380. }
  381. .addressBox{
  382. color: #666666;font-size: 22rpx;
  383. }
  384. .shopImg{
  385. width: 120rpx;
  386. height: 120rpx;
  387. }
  388. .buyLc{
  389. padding: 24rpx 30rpx;
  390. background: #FFFFFF;
  391. margin-top: 20rpx;
  392. }
  393. .lcImg{
  394. width: 618rpx;
  395. height: 22rpx;
  396. }
  397. .lcIMgBox{
  398. text-align: center;
  399. }
  400. .lcline{
  401. font-size: 26rpx;
  402. color: #333333;
  403. }
  404. .lcLineBox{
  405. display: flex;
  406. justify-content: space-around;
  407. padding-top: 20rpx;
  408. }
  409. .goosDetal{
  410. background: #FFFFFF;
  411. margin-top: 20rpx;
  412. }
  413. .goodsDetalTitle{
  414. padding: 24rpx 30rpx;
  415. font-size: 30rpx;
  416. font-weight: 600;
  417. color: #333333;
  418. }
  419. .bottomNoshop{
  420. position: fixed;
  421. left: 0;
  422. bottom: 0;
  423. width: 750rpx;
  424. height: 120rpx;
  425. background: #FFFFFF;
  426. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  427. }
  428. .bottomNoshopBtn{
  429. width: 690rpx;
  430. height: 74rpx;
  431. background: #CCCCCC;
  432. border-radius: 37rpx;
  433. text-align: center;
  434. line-height: 74rpx;
  435. color: #FFFFFF;
  436. margin-top: 29rpx;
  437. margin-left: 30rpx;
  438. }
  439. .callImg{
  440. width: 36rpx;
  441. }
  442. .buyBottomLeftLineTxt{
  443. font-size: 22rpx;
  444. color: #333333;
  445. }
  446. .buyBottom{
  447. position: fixed;
  448. left: 0;
  449. bottom: 0;
  450. width: 750rpx;
  451. height: 120rpx;
  452. background: #FFFFFF;
  453. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  454. display: flex;
  455. }
  456. .buyBtn{
  457. width: 400rpx;
  458. height: 74rpx;
  459. background: #FF4F00;
  460. border-radius: 37rpx;
  461. text-align: center;
  462. line-height: 74rpx;
  463. font-size: 30rpx;
  464. color: #FFFFFF;
  465. margin-top: 23rpx;
  466. margin-left: 50rpx;
  467. }
  468. .buyBottomLeftLine1{
  469. padding-top: 28rpx;
  470. padding-left: 56rpx;
  471. }
  472. .buyBottomLeftLine2{
  473. padding-top: 32rpx;
  474. padding-left: 56rpx;
  475. text-align: center;
  476. }
  477. .buyBottomLeftLine3{
  478. width: 120rpx;
  479. padding-left: 0;
  480. margin-left: 50rpx;
  481. }
  482. .goosDetal /deep/ img{
  483. width: 100vw;
  484. }
  485. .goosDetal image{
  486. width: 100vw;
  487. }
  488. .goosDetal /deep/ p{
  489. margin: 0;
  490. padding: 0;
  491. display: flex;
  492. }
  493. .tihuanBtn{
  494. width: 600rpx;
  495. height: 74rpx;
  496. background: #FF4F00;
  497. border-radius: 37rpx;
  498. text-align: center;
  499. line-height: 74rpx;
  500. font-size: 30rpx;
  501. color: #FFFFFF;
  502. margin-top: 23rpx;
  503. margin-left: 75rpx;
  504. }
  505. </style>