detail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <template>
  2. <view v-if="allShow">
  3. <!--pages/detail/detail.wxml-->
  4. <view class="banner">
  5. <swiper class="swiper" @change="swiperChange" :current="current" autoplay="true" circular="true" duration="1000">
  6. <block v-for="(item, index) in product.images" :key="index">
  7. <swiper-item autoplay="true">
  8. <image :src="item + '?x-oss-process=style/w750-auto'" mode="aspectFit"></image>
  9. </swiper-item>
  10. </block>
  11. </swiper>
  12. <view class="dots dflex">
  13. <block v-for="(item, index) in product.images" :key="index">
  14. <view :class="'dot ' + (index == swiperCurrent ? ' active' : '')" :data-current="index" @tap="dotEvent"></view>
  15. </block>
  16. </view>
  17. </view>
  18. <!-- <view bindtap="saoma">扫码</view> -->
  19. <!-- <view class="notification_bar" wx:if="{{isNotice}}">
  20. <swiper class="swiper_container" vertical="true" autoplay="true" circular="false" duration="1000" interval="5000" easing-function="easeInOutCubic" class="bar_box dflex">
  21. <swiper-item class="bar_con dflex" wx:for="{{contentList}}" wx:key="item">
  22. <view class="bar dflex">
  23. <image class="bar_left" src="{{item.pic}}" />
  24. <text class="bar_text">最新订单来自</text>
  25. <text class="bar_text">{{item.name}},</text>
  26. <text class="bar_text">{{item.time}}</text>
  27. </view>
  28. </swiper-item>
  29. </swiper>
  30. </view> -->
  31. <view class="info bgfff">
  32. <view class="infos dflex">
  33. <view class="price dflex" v-if="product.mode==2">
  34. <text>{{product.integral?product.integral:'0'}}积分</text>
  35. <text class="money" v-if="product.salePrice">+¥{{product.salePrice?product.salePrice:'0'}}</text>
  36. <text class="origin" v-if="product.salePrice == product.actualPrice && product.marketPrice > 0">¥{{product.marketPrice}}</text>
  37. </view>
  38. <view class=" sellStock" v-if="product.sellStock>0">销量:<text>{{product.sellStock}}</text></view>
  39. <view class="share" @tap="showShare">
  40. <image src="/static/pages/images/fxico.png"></image>分享
  41. </view>
  42. </view>
  43. <view class="title">
  44. <image src="/static/pages/images/jishida.png" class="tag" v-if="product.isTimely === 1&&merchant.isDefault!=1"></image>
  45. <image src="/product/static/product/image/overseasPurchase.png" class="tag" v-if="product.isOtc===5"></image>
  46. {{product.title}}
  47. </view>
  48. <view class="protext">
  49. {{product.brandName ? product.brandName : ''}} {{product.brief ? product.brief : ''}}
  50. </view>
  51. <!-- <view class="xiaodian dflex" wx:if="{{hideShop=='true'}}">
  52. <image src="/pages/images/xdbg1.png" class="xdbg"></image>
  53. <view class="shouyi flex">
  54. <text>销售收益</text>
  55. <view>8.65<text>元</text></view>
  56. </view>
  57. <view class="addshop" bindtap="addShop">添加到小店</view>
  58. </view> -->
  59. </view>
  60. <view class="detinfo mt20 bgfff">
  61. <!-- <view class="item dflex">
  62. <label>优惠券</label>
  63. <view class="quan flex dflex">
  64. <view class="flex dflex">
  65. <text>满500减50</text>
  66. <text>满200减10</text>
  67. </view>
  68. <view class="ling dflex">领券<image src="/pages/images/more3.png"></image></view>
  69. </view>
  70. </view> -->
  71. <view class="item dflex">
  72. <label>配送至</label>
  73. <view class="flex" @tap="toAddress">
  74. <view class="address">{{address.address}}{{address.house}}</view>
  75. <view class="huo"><text>现货</text>
  76. <!-- 现在下单,预计2小时后送达 -->
  77. </view>
  78. </view>
  79. <image src="/static/pages/images/more2.png" class="more" @tap="toAddress"></image>
  80. </view>
  81. <!-- <view class="item dflex">
  82. <label>服务门店</label>
  83. <view class="flex" bindtap="updateShop">
  84. <view class="address">{{merchant.title}}</view>
  85. </view>
  86. </view> -->
  87. </view>
  88. <!-- 海外购 -->
  89. <!-- <view class="detinfo mt20 bgfff" wx:if="{{product.isOtc==5}}">
  90. <view class="item">
  91. <view class="dflex">
  92. <label>物流</label>
  93. <view class="">
  94. <view class="address">20:00前付款,预计9月30日前送达</view>
  95. </view>
  96. </view>
  97. <view class="dflex logistics">
  98. <view class="lsicText">
  99. <image src="/product/image/abroad.png" class="abroad"></image>
  100. 德国进口
  101. </view>
  102. <image src="/product/image/you_h.png" class="you"></image>
  103. <view class="lsicText">
  104. <image src="/product/image/bonded.png" class="abroad"></image>
  105. 保税店
  106. </view>
  107. <image src="/product/image/you.png" class="you"></image>
  108. <view>
  109. <image src="/product/image/position.png" class="abroad"></image>
  110. 长沙市
  111. </view>
  112. </view>
  113. </view>
  114. </view> -->
  115. <!-- 商品详情等页面 -->
  116. <product-footer id="list" ref="list" :detail="nodes" :imgs="imgs" :proId="product.id" v-if="product.id" :form="form" @scoreTab="scoreTab" @showTab="showTab" @freshen="freshenFun"></product-footer>
  117. <v-share :hide-toast="hideShare" :product="product" :code-url="codeUrl" @onFather="click"></v-share>
  118. <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 140) + 'rpx'"></view>
  119. <view class="bot fixed bgfff dflex" :style="'padding-bottom: ' + (bottomBlankHeight + 20) + 'rpx'">
  120. <view class="btnfot">
  121. <contact-button img-url="/static/pages/images/kfico.png" class-name="botbtn" button-text="客服"></contact-button>
  122. <navigator class="botbtn" open-type="reLaunch" url="/integralshop/cart/cart?integralshop=1" hover-class="none">
  123. <image src="/static/pages/images/gwc.png"></image>购物车<text class="message" v-if="product.count > 0">{{product.count}}</text>
  124. </navigator>
  125. </view>
  126. <view class="btnbuy">
  127. <view :class="'addcart ' + (product.stock >= 1 && product.state == 1 ? '' : 'gray')" @tap="product.stock >= 1 && product.state == 1 ? addShopCart() : ''">加入购物车</view>
  128. <view class="gmbtn mbglinear" @tap="atOnceBuy" v-if="product.stock >= 1 && product.state == 1">
  129. {{product.isOtc==1 ?'预约下单': '立即兑换'}}</view>
  130. <view class="gmbtn mbggray" v-if="product.stock < 1 && product.state == 1">立即兑换</view>
  131. <!-- <view class="gmbtn kan-guoqi" wx:if="{{product.stock < 1 && product.state == 1}}">
  132. 商品已售罄</view> -->
  133. <!-- <view class="integral mbggray" >积分不足</view> -->
  134. <view class="gmbtn mbggray" v-if="product.state == 2">已下架</view>
  135. </view>
  136. </view>
  137. <view class="xiajia" v-if="product.stock < 1 && product.state == 1">您来晚了,商品已经卖完了</view>
  138. <view class="xiajia" v-if="product.state == 2">您来晚了,商品已经下架</view>
  139. <!-- 商品规格 -->
  140. <block v-if="isShow">
  141. <product-popup :product="product" :order-type="'11'" :is-cart="isCart" :is-timely="product.isTimely" :merchant="merchant" :merchant-id="merchantId" @hidePopup="hidePopup" @addCartSuccess="addCartSuccess">
  142. </product-popup>
  143. </block>
  144. <!-- 返回顶部 -->
  145. <view class="contact_index" @tap="goTop">
  146. <image src="/static/pages/images/backtop.png"></image>顶部
  147. </view>
  148. <!-- 添加到小店成功 -->
  149. <!-- <view class="mask" hidden="{{isHide}}" bindtap="hidePop"></view>
  150. <view class="suc" hidden="{{isHide}}">
  151. <image src="/pages/images/tjcg1.png" class="tjcg1"></image>
  152. <image src="/pages/images/tjcg.png" class="tjcg"></image>
  153. <text>快去我的小店看看吧</text>
  154. <navigator url="/mine/shop/shop" hover-class="none" class="shop">我的小店</navigator>
  155. <view class="share-btn dflex">
  156. <button class="wxfriend dflex" open-type="share">
  157. <image src="/pages/images/wechat.png"></image>
  158. 微信好友
  159. </button>
  160. <view class="wxposter dflex" bindtap="generatePoster">
  161. <image src="/pages/images/poster.png"></image>
  162. 生成海报
  163. </view>
  164. </view>
  165. <image src="/pages/images/close2.png" class="suc-close" bindtap="hidePop"></image>
  166. </view> -->
  167. </view>
  168. </template>
  169. <script>
  170. const app = getApp();
  171. const req = require("../../utils/request.js");
  172. const utils = require("../../utils/util.js");
  173. var QQMapWX = require("../../utils/qqmap.js");
  174. const route = require("../../utils/route");
  175. import productFooter from "../../components/product_footer/index";
  176. import productPopup from "../../components/product-popup/index";
  177. import vShare from "../../components/share/share";
  178. export default {
  179. data() {
  180. return {
  181. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  182. swiperCurrent: 0,
  183. bannerUrls: [],
  184. isShow: false,
  185. pro: {},
  186. isCart: false,
  187. timer: [],
  188. hideShare: true,
  189. codeUrl: '',
  190. contentList: [{
  191. pic: "/static/pages/images/bar.png",
  192. name: '好风依旧',
  193. time: '4秒前'
  194. }, {
  195. pic: "/static/pages/images/bar.png",
  196. name: '杨鑫',
  197. time: '20秒前'
  198. }, {
  199. pic: "/static/pages/images/bar.png",
  200. name: '杨鑫',
  201. time: '5秒前'
  202. }],
  203. isNotice: false,
  204. form: {
  205. page: 1,
  206. limit: 10
  207. },
  208. freshen: true // hideShop: '',//隐藏添加到小店
  209. // isHide: true,//添加小店成功弹窗
  210. ,
  211. current: "",
  212. merchantId: "",
  213. hideShop: "",
  214. merchant: "",
  215. shopId: "",
  216. imgs: [],
  217. product: "",
  218. nodes: "",
  219. address: "",
  220. popup: "",
  221. tabIndex: "",
  222. allShow:false
  223. };
  224. },
  225. components: {
  226. productFooter,
  227. productPopup,
  228. vShare
  229. },
  230. props: {},
  231. onLoad: function (options) {
  232. let that = this;
  233. // console.log(options);
  234. this.query = options;
  235. if (options.scene) {
  236. this.scene = options.scene;
  237. this.merchantId = options.merchantId;
  238. }
  239. if (options.merchantId) {
  240. that.setData({
  241. merchantId: options.merchantId
  242. });
  243. }
  244. if (options.isShare) {
  245. req.setStorage('pidCode', options.userId);
  246. }
  247. if (options.hideShop) {
  248. this.setData({
  249. hideShop: this.query.hideShop
  250. });
  251. } else {
  252. this.setData({
  253. hideShop: 'true'
  254. });
  255. }
  256. if (options.merchantId && options.merchantId != 'undefined') {
  257. req.getRequest('/api/merchant/detail', {
  258. id: options.merchantId
  259. }, data => {
  260. var timestamp = Date.parse(new Date());
  261. data.time=timestamp+1*60*1000
  262. req.setStorage("MERCHANT", data);
  263. that.setData({
  264. merchant: data
  265. });
  266. // console.log(data, "执行+++++++++++++++++++++");
  267. });
  268. } else {
  269. let merchant = req.getStorage('MERCHANT');
  270. this.setData({
  271. merchant: merchant
  272. });
  273. } // else{
  274. // req.getRequest('/api/merchant/getMerchantList',{}, res => {
  275. // res = res.filter(it=>it.isDefault==1)
  276. // req.setStorage('MERCHANT', res[0]);
  277. // this.data.merchant=res[0]
  278. // that.setData({merchant:res[0]})
  279. // console.log(this.data.merchant)
  280. // })
  281. // }
  282. setInterval(() => {
  283. this.setData({
  284. isNotice: true
  285. });
  286. }, 10000);
  287. },
  288. onShow: async function () {
  289. if (this.freshen) {
  290. await this.loadCodeParams();
  291. this.loadProudct(this.query);
  292. this.loadDefaultAddress();
  293. this.browsRecound(this.query.id);
  294. }
  295. },
  296. onShareAppMessage: function () {
  297. let merchantId = '';
  298. let path = '/integralshop/detail/detail?id=' + this.query.id + '&isShare=' + true;
  299. // console.log(!req.getStorage('userInfo').id);
  300. if (!req.getStorage('userInfo').id) {} else {
  301. path += '&userId=' + req.getStorage('userInfo').id;
  302. }
  303. // console.log(this.query.merchantId);
  304. let shopId = '';
  305. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  306. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  307. merchantId = req.getStorage('MERCHANT').id;
  308. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  309. path += '&shopId=' + req.getStorage('smallShop').id;
  310. shopId = req.getStorage('smallShop').id;
  311. merchantId = req.getStorage('smallShop').merchantDTO.id;
  312. }
  313. }
  314. route.share(1, req.getStorage('userInfo').id, path, merchantId, shopId, 1, this.query.id);
  315. // console.log(path);
  316. return {
  317. title: this.product.title,
  318. imageUrl: this.product.pic,
  319. path: path
  320. }; // let merchantId=''
  321. // // if(this.data.merchant.isDefault!=1){
  322. // // merchantId=this.data.merchant.id
  323. // // }
  324. // if(this.query.merchantId) merchantId=this.query.merchantId
  325. // return {
  326. // title: this.data.product.title,
  327. // imageUrl: this.data.product.pic,
  328. // path: '/integralshop/detail/detail?id=' + this.query.id + '&isShare=' + true + '&userId=' + req.getStorage('userInfo').id+'&merchantId='+merchantId
  329. // }
  330. },
  331. onReachBottom() {
  332. if (this.is_open_comments == 1 && this.tabIndex == 2) {
  333. this.form.page++;
  334. this.setData({
  335. ['form.page']: this.form.page
  336. });
  337. // this.selectComponent("#list").loadScore(this.current);
  338. this.$refs.list.loadScore(this.current);
  339. }
  340. } // addShop() {//添加到小店
  341. // req.postRequest('/api/shopProduct/save',{productId:this.data.product.id,type:1},data=>{
  342. // console.log(data)
  343. // this.setData({ isHide: false })
  344. // })
  345. // },
  346. // hidePop() {//添加到小店
  347. // this.setData({ isHide: true })
  348. // }
  349. ,
  350. methods: {
  351. click(e){
  352. // console.log(e)
  353. this.hideShare=e
  354. },
  355. showShare() {
  356. // #ifndef H5
  357. req.isLogin().then(success => {
  358. if (success) {
  359. this.setData({
  360. hideShare: false
  361. });
  362. this.getCodeUrl()
  363. }
  364. });
  365. // #endif
  366. },
  367. /**
  368. * 轮播切换
  369. */
  370. swiperChange({
  371. detail
  372. }) {
  373. if (this.current == 0 && this.swiperCurrent > 1) {
  374. //卡死时,重置current为正确索引
  375. this.setData({
  376. current: this.swiperCurrent
  377. });
  378. } else {
  379. //正常轮转时,记录正确页码索引
  380. this.setData({
  381. swiperCurrent: detail.current
  382. });
  383. }
  384. },
  385. dotEvent(e) {
  386. this.setData({
  387. current: e.currentTarget.dataset.current
  388. });
  389. },
  390. browsRecound(id) {
  391. let from = {
  392. bindId: id,
  393. type: 1,
  394. page: '/integralshop/detail/detail?id=' + this.query.id
  395. }; // if(this.query.scene){
  396. // from.shareType=12
  397. // from.page='/product/detail/detail?id=' + this.data.query.id +'&scene='+this.query.scene
  398. // if(!this.data.params.merchantId){}else{
  399. // from.merchantId=this.data.params.merchantId
  400. // }
  401. // if(!this.data.params.shopId){}else{
  402. // from.shopId=this.data.params.shopId
  403. // }
  404. // if(!this.data.params.userId){}else{
  405. // from.uid=this.data.params.userId
  406. // }
  407. // }
  408. if (this.query.isShare) {
  409. from.shareType = 1;
  410. from.page = '/integralshop/detail/detail?id=' + this.query.id + '&isShare=' + true;
  411. if (!this.query.userId) {} else {
  412. from.page += '&userId=' + this.query.userId;
  413. }
  414. if (!this.query.merchantId) {} else {
  415. from.merchantId = this.query.merchantId;
  416. }
  417. if (!this.query.shopId) {} else {
  418. from.shopId = this.query.shopId;
  419. }
  420. if (!this.query.userId) {} else {
  421. from.uid = this.query.userId;
  422. }
  423. }
  424. if (this.query.isShareTimeline) {
  425. from.shareType = 2;
  426. from.page = '/integralshop/detail/detail?id=' + this.query.id + '&isShareTimeline=' + true;
  427. if (!this.query.userId) {} else {
  428. from.page += '&userId=' + this.query.userId;
  429. }
  430. if (!this.query.merchantId) {} else {
  431. from.merchantId = this.query.merchantId;
  432. }
  433. if (!this.query.shopId) {} else {
  434. from.shopId = this.query.shopId;
  435. }
  436. if (!this.query.userId) {} else {
  437. from.uid = this.query.userId;
  438. }
  439. }
  440. req.postRequest('/api/browse', from, data => {});
  441. },
  442. // 选择服务门店
  443. updateShop() {
  444. let url = 'pages/nearby/nearby?isChoose=true';
  445. app.globalData.openPage(url); // let url = 'pages/nearby/nearby';
  446. // app.openPage(url)
  447. },
  448. loadCodeParams() {
  449. let _ts = this;
  450. return new Promise((resolve, reject) => {
  451. let form = {
  452. scene: _ts.scene
  453. };
  454. if (!_ts.scene) {
  455. resolve();
  456. return false;
  457. }
  458. if (_ts.merchantId) {
  459. // console.log("解析出来有门店");
  460. form.merchantId = _ts.merchantId;
  461. }
  462. req.getRequest('/api/code/params', form, data => {
  463. // console.log("====================================================================================" + data.merchantId);
  464. let res = data.scene.split('_');
  465. // console.log(res);
  466. this.query.id = res[0];
  467. this.query.merchantId = res[1];
  468. this.query.shopId = res[2]; // this.query.id = res[0];
  469. // this.query.merchantId = res[1];
  470. // this.query.shopId = res[2];
  471. if (res[1]) {
  472. this.setData({
  473. merchantId: res[1]
  474. });
  475. }
  476. if (res[2]) {
  477. this.setData({
  478. shopId: res[2]
  479. });
  480. }
  481. req.setStorage('pidCode', data.userId); // if (this.query.scene) {
  482. // this.loadProudct();
  483. // }
  484. // this.browsRecound(this.query.id);
  485. resolve();
  486. });
  487. });
  488. },
  489. loadProudct(query) {
  490. // console.log(this.query)
  491. // const query = this.query;
  492. let that = this;
  493. // console.log(query.merchantId);
  494. let form = {
  495. id: query.id
  496. };
  497. if (query.merchantId) form.merchantId = query.merchantId;
  498. let isShowLoading = false;
  499. if (!isShowLoading) {
  500. req.loadIng('加载中');
  501. isShowLoading = true;
  502. }
  503. req.getRequest('/api/product/detail', form, data => {
  504. //富文本图片放大
  505. var nodes = data.detail;
  506. if (data.isOtc == 5) {
  507. uni.setNavigationBarTitle({
  508. title: '海外购'
  509. });
  510. }
  511. that.setData({
  512. bannerUrls: data.images,
  513. product: data,
  514. nodes: nodes,
  515. allShow:true
  516. });
  517. if (isShowLoading) {
  518. uni.hideLoading();
  519. isShowLoading = false;
  520. }
  521. // if (data.detail) {
  522. // this.setData({ detail: data.detail.replace(/\<img/gi, '<img class="rich-img"') })
  523. // }
  524. });
  525. },
  526. getCodeUrl() {
  527. let that = this;
  528. let scene = that.product.id;
  529. if (!this.merchantId) {} else {
  530. scene += '_' + this.merchantId;
  531. }
  532. // console.log(scene); //获取小程序码
  533. const params = {
  534. page: 'integralshop/detail/detail',
  535. scene: scene
  536. }; // if(this.data.merchant&&this.data.merchant.isDefault!=1){
  537. // params.merchantId=this.data.merchant.id
  538. // }
  539. if (this.query.merchantId) var merchantId = this.query.merchantId;
  540. req.getRequest('/api/program/codev', params, url => {
  541. that.setData({
  542. codeUrl: url
  543. });
  544. });
  545. },
  546. loadDefaultAddress() {
  547. if (req.isAuth()) {
  548. req.g('/api/address/default', data => {
  549. if (data) this.setData({
  550. address: data
  551. });else this.pointLocation();
  552. }, true);
  553. } else {
  554. this.pointLocation();
  555. }
  556. },
  557. pointLocation() {
  558. //定位当前位置
  559. let _ts = this;
  560. QQMapWX.initMap();
  561. req.getLocation(res => {
  562. QQMapWX.reverseGeocoder(res, data => {
  563. _ts.setData({
  564. 'address.address': data.address
  565. });
  566. });
  567. });
  568. },
  569. toAddress() {
  570. app.globalData.openPage('mine/address/address');
  571. },
  572. atOnceBuy() {
  573. this.setData({
  574. isShow: true,
  575. isCart: false,
  576. popup: this.product
  577. });
  578. },
  579. addShopCart() {
  580. this.setData({
  581. isShow: true,
  582. isCart: true,
  583. popup: this.product
  584. });
  585. },
  586. hidePopup() {
  587. this.setData({
  588. isShow: false
  589. });
  590. },
  591. addCartSuccess(event) {
  592. this.setData({
  593. 'product.count': parseInt(this.product.count) + parseInt(event.detail.quantity),
  594. isShow: false
  595. });
  596. },
  597. clickCollect() {
  598. let _ts = this;
  599. req.postRequest('/api/collect', {
  600. bindId: this.product.id,
  601. type: 1
  602. }, data => {
  603. _ts.setData({
  604. 'product.isCollect': !_ts.product.isCollect
  605. });
  606. });
  607. },
  608. goTop: function (e) {
  609. // 一键回到顶部
  610. if (uni.pageScrollTo) {
  611. uni.pageScrollTo({
  612. scrollTop: 0
  613. });
  614. } else {
  615. uni.showModal({
  616. title: '提示',
  617. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  618. });
  619. }
  620. },
  621. onShareTimeline() {
  622. let merchantId = '';
  623. let path = 'id=' + this.query.id + '&isShareTimeline=' + true;
  624. if (!req.getStorage('userInfo').id) {} else {
  625. path += '&userId=' + req.getStorage('userInfo').id;
  626. }
  627. // console.log(this.merchantId);
  628. let shopId = '';
  629. if (!this.merchantId) {
  630. // console.log(123, path);
  631. } else {
  632. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  633. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  634. merchantId = req.getStorage('MERCHANT').id;
  635. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  636. path += '&shopId=' + req.getStorage('smallShop').id;
  637. shopId = req.getStorage('smallShop').id;
  638. merchantId = req.getStorage('smallShop').merchantDTO.id;
  639. }
  640. }
  641. }
  642. let url = '/integralshop/detail/detail?' + path;
  643. route.share(2, req.getStorage('userInfo').id, url, merchantId, shopId, 1, this.query.id);
  644. // console.log(path, url);
  645. return {
  646. title: this.product.title,
  647. query: path,
  648. imageUrl: this.product.images[0]
  649. }; // return {
  650. // title: this.data.product.title,
  651. // path: this.data.product.images[0]
  652. // }
  653. },
  654. showTab: function (e) {
  655. this.setData({
  656. tabIndex: e.detail
  657. });
  658. },
  659. scoreTab: function (e) {
  660. this.form.page = 0;
  661. this.setData({
  662. current: e.detail,
  663. ['form.page']: 1
  664. });
  665. },
  666. freshenFun: function (e) {
  667. this.setData({
  668. freshen: e.detail
  669. });
  670. }
  671. }
  672. };
  673. </script>
  674. <style>
  675. @import "./detail.css";
  676. </style>