detail.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355
  1. <template>
  2. <view :style="[mainStyle]">
  3. <view v-if="allShow">
  4. <!--pages/detail/detail.wxml-->
  5. <view class="banner">
  6. <swiper class="swiper" @change="swiperChange" :current="current" autoplay="true" circular="true"
  7. duration="1000">
  8. <block v-for="(item, index) in product.images" :key="index">
  9. <swiper-item autoplay="true">
  10. <image :src="item + '?x-oss-process=style/w750-auto'" mode="aspectFit"></image>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. <view class="dots dflex">
  15. <block v-for="(item, index) in product.images" :key="index">
  16. <view :class="'dot ' + (index == swiperCurrent ? ' active' : '')" :data-current="index"
  17. @tap="dotEvent"></view>
  18. </block>
  19. </view>
  20. </view>
  21. <view class="info bgfff">
  22. <view class="infos dflex">
  23. <view class="price dflex">
  24. ¥<text>{{product.salePrice?product.salePrice:'0'}}</text>
  25. <text class="origin"
  26. v-if="product.salePrice == product.actualPrice && product.marketPrice > 0&&product.salePrice<product.marketPrice">¥{{product.marketPrice}}</text>
  27. </view>
  28. <view class=" sellStock" v-if="product.sellStock>0">销量:<text>{{product.sellStock}}</text></view>
  29. <view class="share" @tap="showShare">
  30. <image src="/static/pages/images/fxico.png"></image>分享
  31. </view>
  32. </view>
  33. <view class="huiyuan" @tap="govip" v-if="show_membership_price==1&&product.membersPrice!=null">
  34. <!-- &&product.membersPrice<product.salePrice -->
  35. <view class="ddflex huiyuanjia">
  36. <view class="ddflex">
  37. <!-- <image src="/product/static/product/image/huiyuanjia.png" class="huiyuanimg"></image> -->
  38. {{userInfo.level && userInfo.level != 'LV0' ? userInfo.level : '会员价'}}
  39. <text
  40. class="hymoney">¥{{product.actualPrice < product.salePrice ? product.actualPrice : product.membersPrice}}</text>
  41. 立省¥{{product.jianMoney?product.jianMoney:'0'}}
  42. </view>
  43. <view class="d-open" v-if="!userInfo.level">立即开通</view>
  44. <image src="/product/static/product/image/govip.png" class="govipimg" v-else></image>
  45. </view>
  46. </view>
  47. <view class="title">
  48. <image src="/static/pages/images/jishida.png" class="tag"
  49. v-if="product.isJs&&merchant.type!=5&& about.timely_close != 1">
  50. </image>
  51. <image src="/product/static/product/image/overseasPurchase.png" class="tag"
  52. v-if="product.isOtc===5">
  53. </image>
  54. <text class="yushou"
  55. v-if="product.estimatedDeliveryTimeStr">预售</text>{{product.title?product.title:''}}
  56. </view>
  57. <view class="protext">
  58. {{product.brandName ? product.brandName : ''}} {{product.brief ? product.brief : ''}}
  59. </view>
  60. <view class="guarantee dflex" v-if="guarantee.length>0">
  61. <view class="cont dflex">
  62. <view v-for="(item, index) in guarantee" :key="index" class="dflex li">
  63. <image src="/product/static/product/image/guarantee.png"></image>{{item}}
  64. </view>
  65. </view>
  66. </view>
  67. <!-- isOtc 0 默认 1 处方药 2 非处方药 3 医疗器械 4 食品类 5 海外购 -->
  68. <block v-if="product.isOtc!=5">
  69. <block v-if="is_open_shop == 1 && ascription">
  70. <view class="xiaodian dflex malr20"
  71. v-if="((product.isMeCommission != 1 || product.isMeCommission != '1') && product.oneCommission>0) || ((product.isMeCommission == 1 || product.isMeCommission == '1') && product.twoCommission>0) || product.serviceShopRate">
  72. <image :src="picUrlss+'xdbg1.png'" class="xdbg"></image>
  73. <view class="shouyi flex"
  74. v-if="((product.isMeCommission != 1 || product.isMeCommission != '1') && product.oneCommission>0) || ((product.isMeCommission == 1 || product.isMeCommission == '1') && product.twoCommission>0)">
  75. <text>预计分销收益</text>
  76. <view v-if="product.isMeCommission == 0"><text>¥</text>{{product.oneCommission}}</view>
  77. <view v-else><text>¥</text>{{product.twoCommission}}</view>
  78. </view>
  79. <view class="shouyi flex" v-if="product.serviceShopRate">
  80. <text>预计小店服务费</text>
  81. <view><text>¥</text>{{product.serviceShopRate}}</view>
  82. </view>
  83. <view class="dflex" v-if="product.isJoinShop">
  84. <view class="fenxiang" @tap="showShare">分享推广</view>
  85. <navigator :url="url" hover-class="none" class="goShop">去小店</navigator>
  86. </view>
  87. <view class="addshop" @tap="addShop" v-else>添加到小店</view>
  88. </view>
  89. </block>
  90. <block v-else>
  91. <view class="xiaodian dflex malr20"
  92. v-if="((product.isMeCommission != 1 || product.isMeCommission != '1') && product.oneCommission>0) || ((product.isMeCommission == 1 || product.isMeCommission == '1') && product.twoCommission>0)">
  93. <image :src="picUrlss+'xdbg1.png'" class="xdbg"></image>
  94. <view class="shouyi flex">
  95. <text>预计分销收益</text>
  96. <view v-if="product.isMeCommission == 0"><text>¥</text>{{product.oneCommission}}</view>
  97. <view v-else><text>¥</text>{{product.twoCommission}}</view>
  98. </view>
  99. <navigator url="/promote/apply/apply" hover-class="none" class="fenxiang"
  100. v-if="isDistriUser != 2">我要推广</navigator>
  101. <view class="fenxiang" @tap="showShare" v-else>分享推广</view>
  102. </view>
  103. </block>
  104. </block>
  105. </view>
  106. <view class="detinfo mt20 bgfff">
  107. <view class="item dflex" v-if="couponList&&couponList.length>0">
  108. <label>优惠券</label>
  109. <view class="quan flex dflex" @click="jumpUrl('/product/coupon/coupon?productId=' + query.id)">
  110. <view class="flex dflex coupon-list">
  111. <text v-for="(item,index) in couponList" :key="index"
  112. v-if="index < 3">{{item.couponTitle}}</text>
  113. </view>
  114. <view class="ling dflex">领券<image src="/static/pages/images/more3.png"></image>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="item pro-sel dflex" v-if="product.propertiesList && product.propertiesList.length > 0"
  119. @click="product.stock > 0 ? addShopCart() : ''">
  120. <label>已选</label>
  121. <view class="flex">{{product.properties}}</view>
  122. <image src="/static/pages/images/more.png" class="mrico"></image>
  123. </view>
  124. <view class="item pro-time dflex" v-if="product.estimatedDeliveryTimeStr">
  125. <label>预计发货时间</label>
  126. <view class="flex">{{product.estimatedDeliveryTimeStr}} 前发货</view>
  127. </view>
  128. <view class="item dflex">
  129. <label>配送至</label>
  130. <view class="flex" @tap="toAddress">
  131. <view class="address">{{address.address?address.address:''}}{{address.house?address.house:''}}
  132. </view>
  133. <view class="huo" v-if="tabe&&tabe.length>0">
  134. <!-- <text>现货</text> -->
  135. <text v-for="(item, index) in tabe" :key="index" v-if="tabe.length>0">{{item}}</text>
  136. <!-- 现在下单,预计2小时后送达 -->
  137. </view>
  138. </view>
  139. <image src="/static/pages/images/more2.png" class="more" @tap="toAddress"></image>
  140. </view>
  141. <view class="item dflex" v-if="merchant.isDefault!=1">
  142. <label>当前门店</label>
  143. <view class="flex" @tap="updateShop">
  144. <view class="address">{{merchant.title}}</view>
  145. </view>
  146. <image src="/static/pages/images/more2.png" class="more" @tap="updateShop"></image>
  147. </view>
  148. <navigator :url="'/product/supplier/supplier?id=' + product.supplierModel.id" hover-class="none"
  149. class="item det-sup dflex" v-if="about.is_show_supplier == 1 && product.supplierModel">
  150. <label>供应商</label>
  151. <view class="flex">
  152. <view class="dflex">
  153. <view class="sup-name flex tover">{{product.supplierModel.name}}</view>
  154. <image src="/static/pages/images/more.png" class="mrico"></image>
  155. </view>
  156. <view class="sup-bri tover" v-if="product.supplierModel.businessScope">
  157. 主营范围:{{product.supplierModel.businessScope}}</view>
  158. </view>
  159. </navigator>
  160. </view>
  161. <!-- 商品详情等页面 -->
  162. <product-footer ref="list" id="list" :detail="nodes" :imgs="imgs" :proId="product.id" :form="form"
  163. @scoreTab="scoreTab" @showTab="showTab" v-if="product.id" @freshen="freshenFun" @getForm="getForm">
  164. </product-footer>
  165. <v-share :hide-toast="hideShare" :product="product" :code-url="codeUrl" @onFather="click"></v-share>
  166. <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 140) + 'rpx'"></view>
  167. <view class="bot fixed bgfff dflex" :style="'padding-bottom: ' + (bottomBlankHeight + 20) + 'rpx'">
  168. <view class="btnfot">
  169. <view class="botbtn" @click="goHome()">
  170. <image src="/static/pages/images/sy.png"></image>首页
  171. </view>
  172. <view class="botbtn" @tap="jumpCart('pages/cart/cart')">
  173. <image src="/static/pages/images/gwc.png"></image>购物车<text class="message"
  174. v-if="product.count > 0">{{product.count}}</text>
  175. </view>
  176. <view class="botbtn" @tap="clickCollect">
  177. <image src="/static/pages/images/shoucang_h.png" v-if="product.isCollect"></image>
  178. <image src="/static/pages/images/shoucang.png" v-else></image>收藏
  179. </view>
  180. </view>
  181. <view class="btnbuy">
  182. <view
  183. :class="['addcart',product.stock >= 1 && product.state == 1&&product.salePrice>0 ? '' : 'gray']"
  184. @tap="product.stock >= 1 && product.state == 1&&product.salePrice>0 ? addShopCart() : ''">加入购物车
  185. </view>
  186. <view class="gmbtn mbglinear" @tap="atOnceBuy"
  187. v-if="product.stock >= 1 && product.state == 1&&product.salePrice>0">
  188. {{product.isOtc==1 ?'预约下单': '立即购买'}}
  189. </view>
  190. <view class="gmbtn mbggray" v-if="(product.stock < 1)&&load">已售罄</view>
  191. <block v-else>
  192. <view class="gmbtn mbggray" v-if="(product.state != 1||!product.salePrice)&&load">已下架</view>
  193. </block>
  194. <view class="gmbtn mbggray" v-if="product.stock < 1 && product.state == 1&&product.salePrice>0">立即购买
  195. </view>
  196. </view>
  197. </view>
  198. <view class="xiajia" v-if="product.stock < 1">您来晚了,商品已售罄</view>
  199. <block v-else>
  200. <view class="xiajia" v-if="(product.state !=1 ||!product.salePrice) &&load">您来晚了,商品已经下架</view>
  201. </block>
  202. <!-- 商品规格 -->
  203. <block v-if="isShow">
  204. <product-popup :product="popup" :order-type="1" :is-cart="isCart" :is-timely="product.isTimely"
  205. :merchant="merchant" :merchant-id="merchantId" @hidePopup="hidePopup"
  206. @addCartSuccess="addCartSuccess" :index="index" :shopId="query.shopId" @freshen="changeFreshen"
  207. @getPor="getPor">
  208. </product-popup>
  209. </block>
  210. <!-- 返回顶部 -->
  211. <button open-type="contact" class="side-contact">
  212. <image src="/static/pages/images/kfico1.png"></image>客服
  213. </button>
  214. <view class="contact_index" @tap="goTop">
  215. <image src="/static/pages/images/backtop.png"></image>顶部
  216. </view>
  217. <!-- 添加到小店成功 -->
  218. <view class="mask" :hidden="isHide" @tap="hidePop"></view>
  219. <view class="suc" :hidden="isHide">
  220. <image :src="picUrlss + 'tjcg1.png'" class="tjcg1"></image>
  221. <image :src="picUrlss+'tjcg.png'" class="tjcg"></image>
  222. <text>快去我的小店看看吧</text>
  223. <view class="shopcc dflex">
  224. <view class="shop" @tap="showShare">分享推广</view>
  225. <navigator :url="url" hover-class="none" class="shop">我的小店</navigator>
  226. </view>
  227. <image src="/static/pages/images/close2.png" class="suc-close" @tap="hidePop"></image>
  228. </view>
  229. <block v-if="isActive">
  230. <product-acitvity @hideActive="hideActive"></product-acitvity>
  231. </block>
  232. <block v-if="isPopupLogin">
  233. <product-login :about="about" @hidePopupLogin="hidePopupLogin"></product-login>
  234. </block>
  235. <!-- 订单购买轮播 -->
  236. <view :class="(marqueeOrderItem ? 'roll-notice ' : '') + 'dflex'" v-if="marqueeOrderItem">
  237. <image :src="marqueeOrderItem.avatar"></image>
  238. <view class="flex">{{ marqueeOrderItem.time }} 购买了{{ marqueeOrderItem.productName }}</view>
  239. </view>
  240. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
  241. @closeUpdate="closeUpdate"></update-userinfo>
  242. <privacy :is-update="true" @getLocations="initLocation"></privacy>
  243. </view>
  244. <!-- #ifdef H5 -->
  245. <wx-share ref="wxshare" />
  246. <!-- #endif -->
  247. </view>
  248. </template>
  249. <script>
  250. const app = getApp();
  251. const req = require("../../utils/request.js");
  252. const utils = require("../../utils/util.js");
  253. var QQMapWX = require("../../utils/qqmap.js");
  254. const route = require("../../utils/route");
  255. const api = require("../../utils/api.js");
  256. import productFooter from "../../components/product-footer/index";
  257. import productPopup from "../../components/product-popup/index";
  258. import vShare from "../../components/share/share";
  259. import productAcitvity from "../../components/product-activity/index";
  260. import productLogin from "../../components/product-login/index";
  261. import h5util from "../../utils/h5util";
  262. const actionsdk = require('../../action_sdk/actionsdk-1.0.0.js');
  263. export default {
  264. data() {
  265. return {
  266. picUrlss: req.public.picUrls,
  267. mainStyle: app.globalData.mainStyle,
  268. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  269. swiperCurrent: 0,
  270. bannerUrls: [],
  271. isShow: false,
  272. pro: {},
  273. isCart: false,
  274. timer: [],
  275. hideShare: true,
  276. codeUrl: '',
  277. form: {
  278. page: 1,
  279. limit: 10
  280. },
  281. contentList: [{
  282. pic: "/static/pages/images/bar.png",
  283. name: '好风依旧',
  284. time: '4秒前'
  285. }, {
  286. pic: "/static/pages/images/bar.png",
  287. name: '杨鑫',
  288. time: '20秒前'
  289. }, {
  290. pic: "/static/pages/images/bar.png",
  291. name: '杨鑫',
  292. time: '5秒前'
  293. }],
  294. isNotice: false,
  295. hideShop: true,
  296. //隐藏添加到小店
  297. isHide: true,
  298. //添加小店成功弹窗
  299. url: '/mine/shop/shop',
  300. freshen: true,
  301. //是否更新页面
  302. isActive: false,
  303. current: "",
  304. query: "",
  305. merchantId: "",
  306. merchant: "",
  307. userInfo: "",
  308. ascription: false, //是否开启小店
  309. guarantee: "",
  310. show_membership_price: "",
  311. Is_Store_Price_Stock: "",
  312. is_open_shop: "",
  313. is_open_comments: "",
  314. shopId: "",
  315. params: "",
  316. product: "",
  317. nodes: "",
  318. imgs: [],
  319. tabe: "",
  320. load: false,
  321. address: {},
  322. index: "",
  323. popup: "",
  324. tabIndex: "",
  325. switch: true,
  326. about: {},
  327. allShow: false,
  328. isDistriUser: 0, // 判断用户是否是分销员 2为分销员
  329. isPopupLogin: false,
  330. marqueeOrderItemIndex: 0,
  331. marqueeOrderItem: '',
  332. isShowTime: false,
  333. couponList: [],
  334. isVideoScene: false, //立即购买是否需要登录
  335. isShowUpdate: false, //是否显示更新信息弹窗
  336. isUpdateInfo: false, //更新用户信息
  337. isUpdateMobile: false, //绑定手机号
  338. };
  339. },
  340. components: {
  341. productFooter,
  342. productPopup,
  343. vShare,
  344. productAcitvity,
  345. productLogin
  346. },
  347. onLoad: async function(options) {
  348. let that = this;
  349. // console.log(options);
  350. this.query = options;
  351. this.setData({
  352. query: options
  353. });
  354. if (options.scene) {
  355. this.scene = options.scene;
  356. this.merchantId = options.merchantId;
  357. }
  358. if (options.merchantId) {
  359. that.setData({
  360. merchantId: options.merchantId
  361. });
  362. }
  363. if (options.userMerchantId) {
  364. req.setStorage('user_merchantId', options.userMerchantId)
  365. }
  366. if (options.isShare || options.isShareTimeline) {
  367. req.setStorage('pidCode', options.userId);
  368. let params = {
  369. userId: options.userId,
  370. merchantId: options.merchantId ? options.merchantId : '',
  371. }
  372. await this.bindUser(params);
  373. } else {
  374. }
  375. return false
  376. if (options.hideShop) {
  377. this.setData({
  378. hideShop: false
  379. });
  380. } // if (options.merchantId && options.merchantId != 'undefined') {
  381. // req.getRequest('/api/merchant/detail', { id: options.merchantId }, data => {
  382. // req.setStorage("MERCHANT", data)
  383. // that.setData({ merchant: data })
  384. // console.log(data, "执行+++++++++++++++++++++")
  385. // })
  386. // } else {
  387. // let merchant = req.getStorage('MERCHANT');
  388. // this.setData({ merchant: merchant });
  389. // }
  390. // else{
  391. // // req.getRequest('/api/merchant/getMerchantList',{}, res => {
  392. // // res = res.filter(it=>it.isDefault==1)
  393. // // req.setStorage('MERCHANT', res[0]);
  394. // // this.data.merchant=res[0]
  395. // // that.setData({merchant:res[0]})
  396. // // console.log(this.data.merchant)
  397. // // })
  398. // let merchant=req.getStorage('MERCHANT')
  399. // that.setData({merchant:merchant})
  400. // }
  401. this.isShop()
  402. setInterval(() => {
  403. this.setData({
  404. isNotice: true
  405. });
  406. }, 10000);
  407. setTimeout(() => {
  408. actionsdk.initAction();
  409. }, 2000)
  410. },
  411. async onShow() {
  412. if (req.getStorage('isVideoScene') && (req.getStorage('scene') == 1176 || req.getStorage('scene') ==
  413. 1177 || req.getStorage('scene') == 1195)) {
  414. this.isVideoScene = true
  415. }
  416. if (this.freshen) {
  417. let that = this;
  418. await this.loadCodeParams();
  419. if (that.scene) {
  420. that.bindUser(that.params);
  421. }
  422. this.getGuarantee().then(data => {
  423. // console.log("debug1", data);
  424. if (this.switch) {
  425. this.getMerchant()
  426. }
  427. })
  428. await this.getProductCoupon()
  429. // if (this.switch) {
  430. // this.getMerchant()
  431. // }
  432. await this.browsRecound(this.query.id);
  433. }
  434. this.getBuyOrderMarquee(!this.isShowTime);
  435. },
  436. onShareAppMessage: async function(options) {
  437. var content = await this.onShareMessage(options);
  438. return content;
  439. },
  440. onReachBottom() {
  441. if (this.is_open_comments == 1 && this.tabIndex == 2) {
  442. this.form.page++;
  443. this.setData({
  444. ['form.page']: this.form.page
  445. });
  446. // this.selectComponent("#list").loadScore(this.current);
  447. // console.log(this.form, "++++++++++++++++")
  448. this.$refs.list.loadScore(this.current, this.form);
  449. }
  450. },
  451. onReady() {
  452. // #ifdef H5
  453. var that = this;
  454. //初始化分享内容
  455. setTimeout(async function() {
  456. var shareContent = await that.onShareMessage();
  457. if (shareContent) {
  458. shareContent.path = window.location.origin + shareContent.path;
  459. }
  460. that.$refs.wxshare.init(shareContent);
  461. }, 4 * 1000);
  462. // #endif
  463. },
  464. methods: {
  465. initLocation() {
  466. this.getMerchant();
  467. },
  468. goHome() {
  469. h5util.jumpIndex('/pages/tabBar/index?channel=home')
  470. // app.globalData.openHome();
  471. },
  472. async onShareMessage(options) {
  473. let merchantId = '';
  474. let path = '';
  475. let isSolution = '';
  476. isSolution = req.env[req.env.NODE_ENV].isSolution;
  477. let userInfo = req.getStorage('userInfo');
  478. let shopId = '';
  479. if (isSolution) {
  480. path = '/share/home/index?appId=' + req.getStorage('appId') + '&userId=' + req.getStorage(
  481. 'userInfo').id;
  482. } else {
  483. path = '/product/detail/detail?id=' + this.query.id
  484. // console.log(!req.getStorage('userInfo').id);
  485. if (!userInfo.id) {} else {
  486. path += '&userId=' + userInfo.id;
  487. }
  488. // console.log(this.query.merchantId);
  489. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  490. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  491. merchantId = req.getStorage('MERCHANT').id;
  492. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  493. path += '&shopId=' + req.getStorage('smallShop').id;
  494. shopId = req.getStorage('smallShop').id;
  495. merchantId = req.getStorage('smallShop').merchantDTO.id;
  496. }
  497. }
  498. if (userInfo.merchantId) {
  499. path += '&userMerchantId=' + userInfo.merchantId;
  500. }
  501. }
  502. route.share(1, userInfo.id, path, merchantId, shopId, 1, this.query.id);
  503. path = this.SHARE_BEHAVIOR_FN({path:path,sendShare:false}).path
  504. console.log('---share path----',path)
  505. return {
  506. title: this.product.title,
  507. imageUrl: this.product.pic,
  508. path: path
  509. };
  510. },
  511. getBuyOrderMarquee(isToTime) {
  512. console.log('getBuyOrderMarquee数据获取>>>>>>');
  513. req.getRequest('/api/product/buyDynamic', {}, data => {
  514. this.isShowTime = true;
  515. this.buyOrderMarqueeList = data;
  516. if (isToTime) {
  517. if (this.buyOrderMarqueeList && this.buyOrderMarqueeList.length > 0) {
  518. this.marqueeOrderItem = this.buyOrderMarqueeList[this.marqueeOrderItemIndex];
  519. this.marqueeOrderItemIndex++;
  520. this.getMarqueeOrderItem();
  521. }
  522. }
  523. });
  524. },
  525. // 首页轮播最新购买记录
  526. getMarqueeOrderItem() {
  527. var tha = this;
  528. setTimeout(function() {
  529. // console.log('数据tha.marqueeOrderItemIndex>>>>', tha.marqueeOrderItemIndex);
  530. tha.marqueeOrderItem = tha.buyOrderMarqueeList[tha.marqueeOrderItemIndex];
  531. if (tha.marqueeOrderItemIndex >= tha.buyOrderMarqueeList.length - 1) {
  532. tha.marqueeOrderItemIndex = 0;
  533. } else {
  534. tha.marqueeOrderItemIndex++;
  535. }
  536. tha.getMarqueeOrderItem();
  537. }, 5000);
  538. },
  539. bindUser(par) {
  540. let userInfo = req.getStorage('userInfo');
  541. if (!userInfo) {
  542. req.silenceLogin(par.userId, par.merchantId ? par.merchantId : par.shopId ? par.shopId : '');
  543. // uni.login({
  544. // success(res) {
  545. // let params = {
  546. // code: res.code,
  547. // }
  548. // if(par.userId){
  549. // params.parentId = par.userId;
  550. // }
  551. // if(par.merchantId || par.shopId){
  552. // params.merchantId = par.merchantId ? par.merchantId : par.shopId ? par.shopId : ''
  553. // }
  554. // return new Promise((resolve, reject) => {
  555. // req.postRequest('/api/v2/login', params, data => {
  556. // resolve();
  557. // });
  558. // })
  559. // }
  560. // });
  561. // this.isPopupLogin = true;
  562. }
  563. },
  564. click(e) {
  565. // console.log(e,"7899")
  566. this.hideShare = e
  567. },
  568. getMerchant() {
  569. let that = this;
  570. api.getMerchant(this.query, req, data => {
  571. that.loadDefaultAddress();
  572. console.log('门店信息==', data)
  573. if (data == 1) {
  574. if (that.about.Many_Store == 1) api.locationShow()
  575. else {
  576. that.getuserInfo(data);
  577. if (req.getStorage('defaultMerchant')) {
  578. that.merchant = req.getStorage('defaultMerchant');
  579. that.query.merchantId = that.merchant.id
  580. } else {
  581. api.defaultMerchant(req, that.query, defaultRes => {
  582. that.merchant = defaultRes;
  583. that.query.merchantId = defaultRes.id
  584. });
  585. }
  586. that.loadProudct(that.query);
  587. }
  588. } else {
  589. that.getuserInfo(data);
  590. if (req.getStorage('userInfo') && that.merchant.id != data.id) {
  591. if (data.type == 5) {
  592. that.query.merchantId = data.merchantDTO.id
  593. that.query.shopId = data.id
  594. } else {
  595. that.query.merchantId = data.id
  596. }
  597. this.loadProudct(this.query);
  598. let pages = getCurrentPages();
  599. var prevPage = pages[pages.length - 2];
  600. // console.log(prevPage, '++++++++++++++++++')
  601. if (prevPage) {
  602. prevPage.$vm.setData({
  603. freshen: true
  604. });
  605. }
  606. } else {
  607. this.loadProudct(this.query);
  608. }
  609. that.merchant = data
  610. }
  611. })
  612. },
  613. async showShare() {
  614. let shareD = await this.onShareMessage()
  615. h5util.jumpShare({
  616. title:shareD.title,
  617. imageUrl:shareD.imageUrl,
  618. path:shareD.path,
  619. shareType:2,
  620. id:this.product.id,
  621. merchantId:this.query.merchantId,
  622. sendBehaviorObj:{
  623. BIND_TYPE : this.BIND_TYPE,
  624. BIND_ID : this.BIND_ID,
  625. USER_ID : this.USER_ID,
  626. SHARE_USER_ID : this.SHARE_USER_ID,
  627. PARENT_CODE : this.PARENT_CODE,
  628. CURRENT_CODE : this.CURRENT_CODE
  629. }
  630. })
  631. },
  632. /**
  633. * 轮播切换
  634. */
  635. swiperChange({
  636. detail
  637. }) {
  638. if (this.current == 0 && this.swiperCurrent > 1) {
  639. //卡死时,重置current为正确索引
  640. this.setData({
  641. current: this.swiperCurrent
  642. });
  643. } else {
  644. //正常轮转时,记录正确页码索引
  645. this.setData({
  646. swiperCurrent: detail.current
  647. });
  648. }
  649. },
  650. dotEvent(e) {
  651. this.setData({
  652. current: e.currentTarget.dataset.current
  653. });
  654. },
  655. // 获取用户信息
  656. getuserInfo(data) {
  657. let that = this;
  658. let userInfo = req.getStorage('userInfo');
  659. // console.log(data, userInfo);
  660. if (userInfo && userInfo.listShopBase && userInfo.listShopBase != null && userInfo.listShopBase.length >
  661. 0) {
  662. if (userInfo.listShopBase[0].merchant_id == data.id && data.type != 5) {
  663. let url = '/mine/shop/shop?merchantId=' + userInfo.listShopBase[0].merchant_id + '&shopId=' +
  664. userInfo.listShopBase[0].id;
  665. that.ascription = true;
  666. that.url = url
  667. }
  668. console.log('that.userInfo==' + that.userInfo)
  669. }
  670. },
  671. // 获取品质保证
  672. getGuarantee() {
  673. return new Promise((data, rej) => {
  674. req.getRequest('/api/config', {}, res => {
  675. req.setStorage('configRes', JSON.stringify(res))
  676. this.about = res
  677. data(res)
  678. if (!this.query.merchantId || this.merchant && this.merchant.isDefault == 1) {
  679. // 切割;拿到数组,然后在过滤掉空值
  680. if (res.b2c_service_guarantee && res.b2c_service_guarantee != null) {
  681. this.setData({
  682. guarantee: res.b2c_service_guarantee.split(";").filter(it => {
  683. return it = it && it.trim();
  684. })
  685. });
  686. }
  687. } else {
  688. if (res.o2o_service_guarantee && res.b2c_service_guarantee != null) {
  689. this.setData({
  690. guarantee: res.o2o_service_guarantee.split(";").filter(it => {
  691. return it = it && it.trim();
  692. })
  693. });
  694. }
  695. }
  696. if (res.show_membership_price) {
  697. this.setData({
  698. show_membership_price: res.show_membership_price
  699. });
  700. }
  701. if (res.Is_Store_Price_Stock) {
  702. this.setData({
  703. Is_Store_Price_Stock: res.Is_Store_Price_Stock
  704. });
  705. }
  706. if (res.is_open_shop) {
  707. this.setData({
  708. is_open_shop: res.is_open_shop
  709. });
  710. }
  711. if (res.is_open_comments) {
  712. this.setData({
  713. is_open_comments: res.is_open_comments
  714. });
  715. }
  716. });
  717. })
  718. },
  719. browsRecound(id) {
  720. let from = {
  721. bindId: id,
  722. type: 1,
  723. page: '/product/detail/detail?id=' + id
  724. };
  725. if (this.query.isShare) {
  726. from.shareType = 1;
  727. from.page = '/product/detail/detail?id=' + this.query.id + '&isShare=' + true;
  728. if (!this.query.userId) {} else {
  729. from.page += '&userId=' + this.query.userId;
  730. }
  731. if (!this.query.merchantId) {} else {
  732. from.merchantId = this.query.merchantId;
  733. }
  734. if (!this.query.shopId) {} else {
  735. from.shopId = this.query.shopId;
  736. }
  737. if (!this.query.userId) {} else {
  738. from.uid = this.query.userId;
  739. }
  740. }
  741. if (this.query.isShareTimeline) {
  742. from.shareType = 2;
  743. from.page = '/product/detail/detail?id=' + this.query.id + '&isShareTimeline=' + true;
  744. if (!this.query.userId) {} else {
  745. from.page += '&userId=' + this.query.userId;
  746. }
  747. if (!this.query.merchantId) {} else {
  748. from.merchantId = this.query.merchantId;
  749. }
  750. if (!this.query.shopId) {} else {
  751. from.shopId = this.query.shopId;
  752. }
  753. if (!this.query.userId) {} else {
  754. from.uid = this.query.userId;
  755. }
  756. }
  757. return new Promise((resolve, reject) => {
  758. req.postRequest('/api/browse', from, data => {
  759. resolve()
  760. })
  761. })
  762. },
  763. async govip() {
  764. if (await req.isAuthFn(true)) {
  765. uni.navigateTo({
  766. url: '/mine/vip/vip'
  767. });
  768. }
  769. },
  770. loadCodeParams() {
  771. let _ts = this;
  772. return new Promise((resolve, reject) => {
  773. let form = {
  774. scene: _ts.scene?_ts.scene:_ts.query.x_code_id
  775. };
  776. if (!_ts.scene && !_ts.query.x_code_id) {
  777. resolve();
  778. return false;
  779. } // if (_ts.merchantId) {
  780. // console.log("解析出来有门店")
  781. // form.merchantId = _ts.merchantId
  782. // }
  783. req.getRequest('/api/code/params', form, data => {
  784. if(_ts.options.x_code_id){
  785. let res = JSON.parse(data.scene)
  786. for(let key in res){
  787. this.query[key] = res[key]
  788. }
  789. resolve();
  790. }else{
  791. // console.log("====================================================================================" + data.merchantId)
  792. // this.data.query.id = data.scene;
  793. let res = JSON.parse(data.scene)
  794. let params = {}
  795. res.map(it => {
  796. if (res.poid) {
  797. _ts.query.id = res.poid
  798. params.id = res.poid
  799. }
  800. if (res.mid) {
  801. _ts.query.merchantId = res.mid
  802. params.merchantId = res.mid
  803. }
  804. if (res.umid) {
  805. req.setStorage('user_merchantId', umid)
  806. }
  807. })
  808. // console.log(res);
  809. // this.query.id = res[0];
  810. // this.query.merchantId = res[1];
  811. // this.query.shopId = res[2]; // this.query.id = res[0];
  812. // this.query.merchantId = res[1];
  813. // this.query.shopId = res[2];
  814. req.setStorage('appId', res.appId);
  815. req.setStorage('pidCode', data.userId);
  816. this.setData({
  817. params: params
  818. });
  819. resolve();
  820. }
  821. });
  822. });
  823. },
  824. loadProudct(query) {
  825. let that = this;
  826. that.getMy();
  827. that.setData({
  828. bannerUrls: [],
  829. product: '',
  830. nodes: ''
  831. });
  832. // console.log(query.merchantId);
  833. let form = {
  834. id: query.id
  835. };
  836. if (query.merchantId) form.merchantId = query.merchantId;
  837. let isShowLoading = false;
  838. this.allShow = false
  839. if (!isShowLoading) {
  840. req.loadIng('加载中');
  841. isShowLoading = true;
  842. }
  843. let userInfo = req.getStorage('userInfo');
  844. if (userInfo.listShopBase && userInfo.listShopBase.length > 0) {
  845. form.shopId = userInfo.listShopBase[0].id;
  846. }
  847. req.getRequest('/api/product/detail', form, async data => {
  848. //富文本图片放大
  849. var nodes = data.detail;
  850. let shareD = await this.onShareMessage()
  851. that.postShareMessage(shareD.title,shareD.imageUrl,shareD.path,{
  852. BIND_TYPE : this.BIND_TYPE,
  853. BIND_ID : this.BIND_ID,
  854. USER_ID : this.USER_ID,
  855. SHARE_USER_ID : this.SHARE_USER_ID,
  856. PARENT_CODE : this.PARENT_CODE,
  857. CURRENT_CODE : this.CURRENT_CODE
  858. })
  859. // console.log(nodes)
  860. // if (nodes) {
  861. // if (nodes.indexOf("src") >= 0) {
  862. // //正则匹配所有图片路径
  863. // var imgs = [];
  864. // nodes = nodes.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
  865. // imgs.push(capture);
  866. // that.setData({
  867. // imgs: imgs
  868. // });
  869. // return '';
  870. // });
  871. // }
  872. // }
  873. if (data.isOtc == 5) {
  874. uni.setNavigationBarTitle({
  875. title: '海外购'
  876. });
  877. }
  878. // console.log(this
  879. // .Is_Store_Price_Stock); // if (data.stock <= 0 && this.data.Is_Store_Price_Stock == 1) {
  880. // req.msgConfirm("该门店产品库存不足,请切换其他门店购买", success => {
  881. // this.updateShop(1)
  882. // // this.query.merchantId=this.data.merchantId
  883. // }, cancel => { })
  884. // }
  885. let tabe = [];
  886. let propertiesList = []
  887. if (data.propertiesList && data.propertiesList.length > 0) {
  888. data.propertiesList.map(it => {
  889. propertiesList.push(it.value);
  890. })
  891. }
  892. data.properties = propertiesList.join(' / ')
  893. if (data.deliverWay != null) {
  894. let arr = ['自提', '邮寄', '同城配送',
  895. '自主配送', '自动发货', '手动发货'
  896. ]; // console.log(data.deliverWay.split(','),JSON.parse(data.deliverWay));
  897. let deliverWay = JSON.parse(data.deliverWay);
  898. deliverWay.forEach(it => {
  899. tabe.push(arr[it - 1]);
  900. });
  901. if (deliverWay.indexOf(3) != -1) data.isJs = true;
  902. }
  903. // console.log(tabe, data);
  904. that.setData({
  905. bannerUrls: data.images,
  906. product: data,
  907. nodes: nodes,
  908. tabe: tabe,
  909. load: true,
  910. allShow: true
  911. });
  912. if (isShowLoading) {
  913. uni.hideLoading();
  914. isShowLoading = false;
  915. }
  916. if (data.membersPrice && data.actualPrice < data.salePrice) {
  917. let jian = parseFloat(data.salePrice - data.actualPrice).toFixed(2);
  918. this.setData({
  919. ['product.jianMoney']: jian
  920. });
  921. }
  922. if (data.membersPrice && data.membersPrice < data.salePrice) {
  923. let jian = parseFloat(data.salePrice - data.membersPrice).toFixed(2);
  924. this.setData({
  925. ['product.jianMoney']: jian
  926. });
  927. } // if (data.detail) {
  928. // this.setData({ detail: data.detail.replace(/\<img/gi, '<img class="rich-img"') })
  929. // }
  930. // that.getCodeUrl();
  931. });
  932. },
  933. getMy() {
  934. let that = this;
  935. let userInfo = req.getStorage('userInfo');
  936. if (!userInfo || userInfo == null) return false;
  937. req.getRequest('/api/user/my', {}, data => {
  938. that.userInfo = data;
  939. that.isDistriUser = data.isDistriUser;
  940. });
  941. },
  942. getCodeUrl() {
  943. let that = this;
  944. let scene = {
  945. poid: that.product.id
  946. }
  947. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  948. scene.mid = req.getStorage('MERCHANT').id;
  949. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  950. scene.sid = req.getStorage('smallShop').id;
  951. }
  952. }
  953. if (req.getStorage('userInfo').merchantId) {
  954. scene.umid = req.getStorage('userInfo').merchantId;
  955. }
  956. if (req.getStorage('appId')) scene.appId = req.getStorage('appId');
  957. console.log('获取小程序码==', scene); //获取小程序码
  958. if (this.parentCode) {
  959. scene.parentCode = this.parentCode
  960. }
  961. const params = {
  962. page: 'product/detail/detail',
  963. scene: JSON.stringify(scene)
  964. };
  965. req.getRequest('/api/program/codev', params, url => {
  966. that.setData({
  967. codeUrl: url
  968. });
  969. });
  970. },
  971. loadDefaultAddress() {
  972. if (req.isAuth()) {
  973. req.g('/api/address/default', data => {
  974. if (data) this.setData({
  975. address: data
  976. });
  977. else {
  978. if (this.about.Many_Store == 1) this.pointLocation();
  979. }
  980. }, true);
  981. } else {
  982. if (this.about.Many_Store == 1) this.pointLocation();
  983. }
  984. },
  985. pointLocation() {
  986. //定位当前位置
  987. let _ts = this;
  988. QQMapWX.initMap(req.public.mapLBSKEY);
  989. req.getLocation(res => {
  990. QQMapWX.reverseGeocoder(res, data => {
  991. _ts.setData({
  992. ['address.address']: data.address
  993. });
  994. });
  995. });
  996. },
  997. toAddress() {
  998. this.changeFreshen()
  999. // h5util.jumpUrlExternal({url:'/mine/address/address'})
  1000. app.globalData.openPage('mine/address/address');
  1001. },
  1002. atOnceBuy() {
  1003. // console.log(this.merchantId);
  1004. if (this.isVideoScene && !req.getStorage('userInfo')) {
  1005. this.bindUser()
  1006. return false;
  1007. }
  1008. // #ifdef MP-WEIXIN
  1009. if (!this.getUpdate()) return false;
  1010. // #endif
  1011. if (!this.query.merchantId) this.setData({
  1012. index: 'index'
  1013. });
  1014. this.setData({
  1015. isShow: true,
  1016. isCart: false,
  1017. popup: this.product
  1018. });
  1019. },
  1020. onActive() {
  1021. this.setData({
  1022. isActive: true
  1023. });
  1024. },
  1025. addShopCart() {
  1026. if (this.isVideoScene && !req.getStorage('userInfo')) {
  1027. this.bindUser()
  1028. return false;
  1029. }
  1030. // #ifdef MP-WEIXIN
  1031. if (!this.getUpdate()) return false;
  1032. // #endif
  1033. if (!this.query.merchantId) this.setData({
  1034. index: 'index'
  1035. });
  1036. this.setData({
  1037. isShow: true,
  1038. isCart: true,
  1039. popup: this.product
  1040. });
  1041. },
  1042. hidePopup() {
  1043. this.setData({
  1044. isShow: false
  1045. });
  1046. },
  1047. changeFreshen() {
  1048. this.freshen = false;
  1049. },
  1050. hidePopupLogin(data) {
  1051. this.isPopupLogin = false;
  1052. },
  1053. hideActive() {
  1054. this.setData({
  1055. isActive: false
  1056. });
  1057. },
  1058. addCartSuccess(event) {
  1059. this.setData({
  1060. 'product.count': parseInt(this.product.count) + parseInt(event.detail.quantity),
  1061. isShow: false
  1062. });
  1063. },
  1064. async clickCollect() {
  1065. let _ts = this;
  1066. if (await req.isAuthFn(true)) {
  1067. req.postRequest('/api/collect', {
  1068. bindId: this.product.id,
  1069. type: 1
  1070. }, data => {
  1071. _ts.setData({
  1072. 'product.isCollect': !_ts.product.isCollect
  1073. });
  1074. });
  1075. }
  1076. },
  1077. goTop: function(e) {
  1078. // 一键回到顶部
  1079. if (uni.pageScrollTo) {
  1080. uni.pageScrollTo({
  1081. scrollTop: 0
  1082. });
  1083. } else {
  1084. uni.showModal({
  1085. title: '提示',
  1086. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  1087. });
  1088. }
  1089. },
  1090. onShareTimeline() {
  1091. let merchantId = '';
  1092. let path = 'id=' + this.query.id + '&isShareTimeline=' + true + '&appId=' + req.getStorage('appId');
  1093. let userInfo = req.getStorage('userInfo');
  1094. if (!userInfo.id) {} else {
  1095. path += '&userId=' + userInfo.id;
  1096. }
  1097. // console.log(this.query.merchantId);
  1098. let shopId = '';
  1099. if (!this.query.merchantId) {
  1100. // console.log(123, path);
  1101. } else {
  1102. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  1103. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  1104. merchantId = req.getStorage('MERCHANT').id;
  1105. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  1106. path += '&shopId=' + req.getStorage('smallShop').id;
  1107. shopId = req.getStorage('smallShop').id;
  1108. merchantId = req.getStorage('smallShop').merchantDTO.id;
  1109. }
  1110. }
  1111. }
  1112. if (userInfo.merchantId) {
  1113. path += '&userMerchantId=' + userInfo.merchantId;
  1114. }
  1115. let url = '/product/detail/detail?' + path;
  1116. route.share(2, userInfo.id, url, merchantId, shopId, 1, this.query.id);
  1117. // console.log(path, url);
  1118. path = this.SHARE_BEHAVIOR_FN({path:path,sendShare:false}).path
  1119. return {
  1120. title: this.product.title,
  1121. query: path,
  1122. imageUrl: this.product.images[0]
  1123. };
  1124. },
  1125. // 选择服务门店
  1126. updateShop(type) {
  1127. if (req.getStorage('user_merchantId')) return false
  1128. let url = '/merchant/nearby/nearby?isChoose=true';
  1129. if (type == 1) {
  1130. url += '&type=' + type;
  1131. }
  1132. if (this.about.User_Limit_Store == 1) {
  1133. } else {
  1134. // h5util.jumpUrlExternal({url:url})
  1135. uni.navigateTo({
  1136. url:url
  1137. })
  1138. }
  1139. },
  1140. onHide() {
  1141. this.setData({
  1142. load: false
  1143. })
  1144. },
  1145. // 是否开启小店
  1146. isShop() {
  1147. if (req.getStorage('distribution')) {
  1148. let dist = req.getStorage('distribution')
  1149. this.setData({
  1150. distr: dist
  1151. })
  1152. console.log(dist)
  1153. if (dist.distributionSmallShopOpen == 1) {
  1154. req.postRequest('/api/shopBase/isOpenShop', {}, data => {
  1155. this.setData({
  1156. isshop: data
  1157. })
  1158. console.log(data)
  1159. })
  1160. }
  1161. }
  1162. },
  1163. addShop() {
  1164. //添加到小店
  1165. req.postRequest('/api/shopProduct/save', {
  1166. productId: this.product.id,
  1167. type: 1
  1168. }, data => {
  1169. // console.log(data);
  1170. this.setData({
  1171. isHide: false
  1172. });
  1173. this.product.isJoinShop = true;
  1174. });
  1175. },
  1176. hidePop() {
  1177. //添加到小店
  1178. this.setData({
  1179. isHide: true
  1180. });
  1181. },
  1182. showTab: function(e) {
  1183. this.setData({
  1184. tabIndex: e.detail
  1185. });
  1186. },
  1187. scoreTab: function(e) {
  1188. this.form.page = 0;
  1189. this.setData({
  1190. current: e.detail,
  1191. ['form.page']: 1
  1192. });
  1193. },
  1194. freshenFun: function(e) {
  1195. this.setData({
  1196. freshen: e.detail
  1197. });
  1198. },
  1199. getForm: function(e) {
  1200. // console.log(e.detail,"qqqqq")
  1201. this.form.page = e.detail
  1202. },
  1203. getPor: function(e) {
  1204. // console.log(e.detail, "qqqqq")
  1205. this.popup = e.detail
  1206. this.product = e.detail
  1207. },
  1208. getProductCoupon() {
  1209. let form = {
  1210. page: 1,
  1211. limit: 3,
  1212. productId: this.query.id
  1213. }
  1214. return new Promise((resolve, reject) => {
  1215. req.getRequest('/api/coupon/listV2', form, data => {
  1216. this.couponList = data;
  1217. resolve();
  1218. })
  1219. })
  1220. },
  1221. jumpUrl(url) {
  1222. this.changeFreshen()
  1223. // h5util.jumpUrlExternal({url:url})
  1224. uni.navigateTo({
  1225. url: url
  1226. })
  1227. },
  1228. getUpdate() {
  1229. let userInfos = req.getStorage('userInfo');
  1230. if (!userInfos.mobile) {
  1231. console.log('没有手机号')
  1232. this.isShowUpdate = true;
  1233. this.isUpdateMobile = true;
  1234. req.setStorage('isShowUpdateMobile', true)
  1235. return false;
  1236. }
  1237. if (!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || userInfos.nickName.indexOf(
  1238. '用户') > -1) {
  1239. console.log('没有昵称')
  1240. this.isShowUpdate = true;
  1241. this.isUpdateInfo = true;
  1242. req.setStorage('isShowUpdateInfo', true)
  1243. return false;
  1244. }
  1245. return true;
  1246. },
  1247. closeUpdate() {
  1248. this.isShowUpdate = false
  1249. this.isUpdateInfo = false;
  1250. this.isUpdateMobile = false;
  1251. },
  1252. jumpCart(url) {
  1253. if (req.getStorage('cartTab')) {
  1254. app.globalData.reLaunchTo(url);
  1255. // h5util.jumpUrlExternal({url:url})
  1256. } else {
  1257. app.globalData.openPage(url)
  1258. // h5util.jumpUrlExternal({url:url})
  1259. }
  1260. }
  1261. }
  1262. };
  1263. </script>
  1264. <style>
  1265. @import "./detail.css";
  1266. </style>