productInfo.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. <template>
  2. <view class="">
  3. <u-loading-page :loading="isLoading"></u-loading-page>
  4. <view class="" v-if="!isLoading">
  5. <u-swiper
  6. @change="swiperChange"
  7. @click="swiperClick"
  8. :list="info.images_arr"
  9. indicator
  10. indicatorMode="dot"
  11. circular
  12. height="338"
  13. imgMode="scaleToFill"
  14. ></u-swiper>
  15. <view class="baseInfo">
  16. <view class="titleBox">
  17. <view class="wechat"> 客服微信:{{ kefu }} </view>
  18. <view class="takeImg" @click="takephotos"> 生成斑马简图 </view>
  19. </view>
  20. <view class="attributeBox">
  21. <view class="attributeItem">
  22. <view class="labelItem">
  23. 编号:<text class="fontWeight">{{ info.code }}</text>
  24. </view>
  25. <view class="labelItem">
  26. 区服:<text class="fontWeight">{{ info.server }}</text>
  27. </view>
  28. </view>
  29. <view class="attributeItem">
  30. <view class="labelItem">
  31. 金伙伴:<text class="fontWeight">{{ info.partner }}</text>
  32. </view>
  33. <view class="labelItem">
  34. vip:<text class="fontWeight">{{ info.level }}</text>
  35. </view>
  36. </view>
  37. <view class="attributeItem">
  38. <view class="labelItem">
  39. 战力:<text class="fontWeight">{{ info.force }}亿</text>
  40. </view>
  41. <view class="labelItem">
  42. 速度:<text class="fontWeight">{{ info.speed }}万</text>
  43. </view>
  44. </view>
  45. <view class="attributeItem">
  46. <view class="labelItem">
  47. 法伤:<text class="fontWeight">{{ info.atk }}万</text>
  48. </view>
  49. <view class="labelItem">
  50. 冰冻:<text class="fontWeight">{{ info.property }}万</text>
  51. </view>
  52. </view>
  53. <view class="attributeItem">
  54. <view class="labelItem">
  55. 渡劫:<text class="fontWeight">{{ info.dj_level }}</text>
  56. </view>
  57. <view class="labelItem">
  58. 小号数量:<text class="fontWeight">{{ info.children }}</text>
  59. </view>
  60. </view>
  61. <view class="attributeItem">
  62. <view class="labelItem">
  63. 是否榜一:<text class="fontWeight">{{
  64. info.top_one == 1 ? "是" : "否"
  65. }}</text>
  66. </view>
  67. <view class="labelItem">
  68. 账号类型:<text class="fontWeight">{{
  69. info.account_type_text
  70. }}</text>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="labelBox">
  76. <view
  77. class="labelItem"
  78. :style="{
  79. backgroundImage: 'url(' + BASE_URL + bg_list.top_bg.value + ')',
  80. }"
  81. v-if="info.is_top == 1"
  82. >
  83. 置顶
  84. </view>
  85. <view
  86. class="labelItem"
  87. :style="{
  88. backgroundImage:
  89. 'url(' + BASE_URL + bg_list.discount_bg.value + ')',
  90. }"
  91. v-if="info.discount == 1"
  92. >
  93. 特价
  94. </view>
  95. <view
  96. class="labelItem"
  97. :style="{
  98. backgroundImage:
  99. 'url(' + BASE_URL + bg_list.recommend_bg.value + ')',
  100. }"
  101. v-if="info.recommend == 1"
  102. >
  103. 斑马推荐
  104. </view>
  105. <view
  106. class="labelItem"
  107. :style="{
  108. backgroundImage: 'url(' + BASE_URL + bg_list.stage_bg.value + ')',
  109. }"
  110. v-if="info.stage == 1"
  111. >
  112. 可分期
  113. </view>
  114. <view
  115. class="labelItem"
  116. :style="{
  117. backgroundImage:
  118. 'url(' + BASE_URL + bg_list.recommend_bg.value + ')',
  119. }"
  120. v-if="info.is_hot == 1"
  121. >
  122. 热门
  123. </view>
  124. <!-- <view class="labelItem" :style="{ backgroundImage:'url('+BASE_URL+bg_list.level_bg.value+')'}" v-if="info.level>=1">
  125. VIP
  126. </view> -->
  127. <view
  128. class="labelItem"
  129. :style="{
  130. backgroundImage: 'url(' + BASE_URL + bg_list.new_bg.value + ')',
  131. }"
  132. v-if="info.is_new == 1"
  133. >
  134. 新品
  135. </view>
  136. <view
  137. class="labelItem"
  138. :style="{
  139. backgroundImage:
  140. 'url(' + BASE_URL + bg_list.standby1_bg.value + ')',
  141. }"
  142. v-if="info.standby1 == 1"
  143. >
  144. {{ info.standby1_title }}
  145. </view>
  146. <view
  147. class="labelItem"
  148. :style="{
  149. backgroundImage:
  150. 'url(' + BASE_URL + bg_list.standby2_bg.value + ')',
  151. }"
  152. v-if="info.standby2 == 1"
  153. >
  154. {{ info.standby2_title }}
  155. </view>
  156. <view
  157. class="labelItem"
  158. :style="{
  159. backgroundImage:
  160. 'url(' + BASE_URL + bg_list.standby3_bg.value + ')',
  161. }"
  162. v-if="info.standby3 == 1"
  163. >
  164. {{ info.standby3_title }}
  165. </view>
  166. <!-- <u-tag v-if="item.discount==1" text="特价" type="error" shape="circle" size="mini"></u-tag>
  167. <u-tag v-if="item.recommend==1" text="斑马推荐" shape="circle" size="mini"></u-tag>
  168. <u-tag v-if="item.stage==1" text="可分期" type="success" shape="circle" size="mini"></u-tag> -->
  169. </view>
  170. <view class="productInfo">
  171. <view class="infoTitle"> 商品详情 </view>
  172. <view class="">
  173. <u-parse :content="info.detail"></u-parse>
  174. </view>
  175. <view class="" v-if="info.content_switch == 1">
  176. <u-parse :content="info.detail2"></u-parse>
  177. </view>
  178. </view>
  179. <view class="productInfo">
  180. <view class="infoTitle"> 免责声明 </view>
  181. <view class="statement">
  182. <u-parse :content="disclaimer"></u-parse>
  183. </view>
  184. </view>
  185. <view class="tabbar">
  186. <view class="back" @click="goBack">
  187. <u-icon name="home-fill" color="#fff"></u-icon>
  188. <span style="font-size: 16px">返回</span>
  189. </view>
  190. <view class="price">
  191. jià格:<text class="bold">{{ info.money }}</text
  192. ><text>米</text>
  193. </view>
  194. <view class="back purchase" @click="showPopup = true"> 流程规则 </view>
  195. </view>
  196. <view class="swiper-item swiper-itemcopy" id="copyswiperItem">
  197. <view
  198. class="titleBox"
  199. :style="{ background: 'url(' + BASE_URL + jt_bg1 + ')' }"
  200. >
  201. <!-- <image :src="BASE_URL+item.qrimage" mode=""></image> -->
  202. <limeQrcodeVue
  203. ref="qrcodeRef"
  204. :value="
  205. BASE_URL1 +
  206. `/h5/#/pages/deal/productInfo?id=${id}` +
  207. (rand_num ? `&rand_num=${rand_num}` : '')
  208. "
  209. size="112rpx"
  210. ></limeQrcodeVue>
  211. <view class="title">
  212. <p>{{ item.title1 }}</p>
  213. <p>{{ item.title2 }}</p>
  214. <p class="warn">{{ item.title3 }}</p>
  215. </view>
  216. </view>
  217. <view
  218. class="content"
  219. :style="{ background: 'url(' + BASE_URL + jt_bg2 + ')' }"
  220. >
  221. <view class="" id="copycontent"> </view>
  222. <view
  223. class="watermark"
  224. v-if="
  225. (item.watermark_info && item.watermark_info.type == 1) ||
  226. (item.watermark_info && item.watermark_info.type == 3)
  227. "
  228. >
  229. <view
  230. v-for="it in 100"
  231. class=""
  232. :style="{
  233. transform: 'rotate(' + item.watermark_info.angle + 'deg)',
  234. opacity: (100 - item.watermark_info.opacity * 1) * 0.01,
  235. color: item.watermark_info.color,
  236. marginTop: item.watermark_info.hh + 'px',
  237. marginBottom: item.watermark_info.hh + 'px',
  238. marginLeft: item.watermark_info.ww + 'px',
  239. marginRight: item.watermark_info.ww + 'px',
  240. fontSize: item.watermark_info.text_font + 'px',
  241. fontWeight: item.watermark_info.bold == 1 ? 'bold' : '',
  242. fontFamily:
  243. item.watermark_info.typeface == 1
  244. ? 'typeface1'
  245. : item.watermark_info.typeface == 2
  246. ? 'typeface2'
  247. : item.watermark_info.typeface == 3
  248. ? 'typeface3'
  249. : item.watermark_info.typeface == 4
  250. ? 'typeface4'
  251. : item.watermark_info.typeface == 5
  252. ? 'typeface5'
  253. : item.watermark_info.typeface == 6
  254. ? 'typeface6'
  255. : '',
  256. }"
  257. >
  258. <image
  259. :src="BASE_URL + item.watermark_info.image"
  260. mode=""
  261. v-if="
  262. item.watermark_info.image && item.watermark_info.type == 1
  263. "
  264. ></image>
  265. <text
  266. v-if="
  267. item.watermark_info.water_text &&
  268. item.watermark_info.type == 3
  269. "
  270. >{{ item.watermark_info.water_text }}</text
  271. >
  272. </view>
  273. </view>
  274. <view
  275. class="watermark1"
  276. :style="{
  277. left:
  278. item.watermark_info.waterPos == 0
  279. ? 0 + item.watermark_info.xx + 'px'
  280. : item.watermark_info.waterPos == 1
  281. ? 0 + item.watermark_info.xx + 'px'
  282. : item.watermark_info.waterPos == 4
  283. ? 0 + item.watermark_info.voffset + 'px'
  284. : item.watermark_info.waterPos == 7
  285. ? 0 + item.watermark_info.xx + 'px'
  286. : item.watermark_info.waterPos == 2
  287. ? 'calc( 40%' + ' + ' + item.watermark_info.xx + 'px )'
  288. : item.watermark_info.waterPos == 5
  289. ? 'calc( 40%' + ' + ' + item.watermark_info.voffset + 'px )'
  290. : item.watermark_info.waterPos == 8
  291. ? 'calc( 40%' + ' + ' + item.watermark_info.xx + 'px )'
  292. : '',
  293. top:
  294. item.watermark_info.waterPos == 0
  295. ? 0 + item.watermark_info.yy + 'px'
  296. : item.watermark_info.waterPos == 1
  297. ? 0 + item.watermark_info.yy + 'px'
  298. : item.watermark_info.waterPos == 2
  299. ? 0 + item.watermark_info.yy + 'px'
  300. : item.watermark_info.waterPos == 3
  301. ? 0 + item.watermark_info.yy + 'px'
  302. : item.watermark_info.waterPos == 4
  303. ? '40%'
  304. : item.watermark_info.waterPos == 5
  305. ? '40%'
  306. : item.watermark_info.waterPos == 6
  307. ? '40%'
  308. : '',
  309. right:
  310. item.watermark_info.waterPos == 3
  311. ? 0 + item.watermark_info.xx + 'px'
  312. : item.watermark_info.waterPos == 6
  313. ? 0 + item.watermark_info.waterPos + 'px'
  314. : item.watermark_info.waterPos == 9
  315. ? 0 + item.watermark_info.xx + 'px'
  316. : '',
  317. bottom:
  318. item.watermark_info.waterPos == 7
  319. ? 0 + item.watermark_info.xx + 'px'
  320. : item.watermark_info.waterPos == 8
  321. ? 0 + item.watermark_info.ww + 'px'
  322. : item.watermark_info.waterPos == 9
  323. ? 0 + item.watermark_info.xx + 'px'
  324. : '',
  325. fontWeight: item.watermark_info.bold == 1 ? 'bold' : '',
  326. fontFamily:
  327. item.watermark_info.typeface == 1
  328. ? 'typeface1'
  329. : item.watermark_info.typeface == 2
  330. ? 'typeface2'
  331. : item.watermark_info.typeface == 3
  332. ? 'typeface3'
  333. : item.watermark_info.typeface == 4
  334. ? 'typeface4'
  335. : item.watermark_info.typeface == 5
  336. ? 'typeface5'
  337. : item.watermark_info.typeface == 6
  338. ? 'typeface6'
  339. : '',
  340. }"
  341. v-if="
  342. (item.watermark_info && item.watermark_info.type == 2) ||
  343. (item.watermark_info && item.watermark_info.type == 4)
  344. "
  345. >
  346. <view
  347. class=""
  348. :style="{
  349. transform: 'rotate(' + item.watermark_info.angle + 'deg)',
  350. color: `rgba(${hexToRgb(item.watermark_info.color).rgb},${
  351. (100 - item.watermark_info.opacity * 1) * 0.01
  352. })`,
  353. fontSize: item.watermark_info.text_font + 'px',
  354. }"
  355. >
  356. <image
  357. :src="BASE_URL + item.watermark_info.image"
  358. mode=""
  359. v-if="
  360. item.watermark_info.image && item.watermark_info.type == 2
  361. "
  362. ></image>
  363. <text
  364. v-if="
  365. item.watermark_info.water_text &&
  366. item.watermark_info.type == 4
  367. "
  368. >{{ item.watermark_info.water_text }}</text
  369. >
  370. </view>
  371. </view>
  372. </view>
  373. </view>
  374. <view class="swiper-item" id="swiperItem">
  375. <view
  376. class="titleBox"
  377. :style="{ background: 'url(' + BASE_URL + jt_bg1 + ')' }"
  378. >
  379. <limeQrcodeVue
  380. v-if="item.id"
  381. ref="qrcodeRef"
  382. :value="BASE_URL1 + '/h5/#/pages/deal/productInfo?id=' + id"
  383. size="112rpx"
  384. ></limeQrcodeVue>
  385. <!-- <image :src="BASE_URL+item.qrimage" mode=""></image> -->
  386. <view class="title">
  387. <p>{{ item.title1 }}</p>
  388. <p>{{ item.title2 }}</p>
  389. <p class="warn">{{ item.title3 }}</p>
  390. </view>
  391. </view>
  392. <view
  393. class="content"
  394. v-if="item.detail"
  395. :style="{ background: 'url(' + BASE_URL + jt_bg2 + ')' }"
  396. >
  397. <view class="" id="content1">
  398. <u-parse :content="item.detail"></u-parse>
  399. </view>
  400. <view
  401. class="watermark"
  402. v-if="
  403. (item.watermark_info && item.watermark_info.type == 1) ||
  404. (item.watermark_info && item.watermark_info.type == 3)
  405. "
  406. >
  407. <view
  408. v-for="it in 100"
  409. class=""
  410. :style="{
  411. transform: 'rotate(' + item.watermark_info.angle + 'deg)',
  412. opacity: (100 - item.watermark_info.opacity * 1) * 0.01,
  413. color: item.watermark_info.color,
  414. marginTop: item.watermark_info.hh + 'px',
  415. marginBottom: item.watermark_info.hh + 'px',
  416. marginLeft: item.watermark_info.ww + 'px',
  417. marginRight: item.watermark_info.ww + 'px',
  418. fontSize: item.watermark_info.text_font + 'px',
  419. fontWeight: item.watermark_info.bold == 1 ? 'bold' : '',
  420. fontFamily:
  421. item.watermark_info.typeface == 1
  422. ? 'typeface1'
  423. : item.watermark_info.typeface == 2
  424. ? 'typeface2'
  425. : item.watermark_info.typeface == 3
  426. ? 'typeface3'
  427. : item.watermark_info.typeface == 4
  428. ? 'typeface4'
  429. : item.watermark_info.typeface == 5
  430. ? 'typeface5'
  431. : item.watermark_info.typeface == 6
  432. ? 'typeface6'
  433. : '',
  434. }"
  435. >
  436. <image
  437. :src="BASE_URL + item.watermark_info.image"
  438. mode=""
  439. v-if="
  440. item.watermark_info.image && item.watermark_info.type == 1
  441. "
  442. ></image>
  443. <text
  444. v-if="
  445. item.watermark_info.water_text &&
  446. item.watermark_info.type == 3
  447. "
  448. >{{ item.watermark_info.water_text }}</text
  449. >
  450. </view>
  451. </view>
  452. <view
  453. class="watermark1"
  454. :style="{
  455. left:
  456. item.watermark_info.waterPos == 0
  457. ? 0
  458. : item.watermark_info.waterPos == 1
  459. ? 0
  460. : item.watermark_info.waterPos == 4
  461. ? 0
  462. : item.watermark_info.waterPos == 7
  463. ? 0
  464. : item.watermark_info.waterPos == 2
  465. ? '40%'
  466. : item.watermark_info.waterPos == 5
  467. ? '40%'
  468. : item.watermark_info.waterPos == 8
  469. ? '40%'
  470. : '',
  471. top:
  472. item.watermark_info.waterPos == 0
  473. ? 0
  474. : item.watermark_info.waterPos == 1
  475. ? 0
  476. : item.watermark_info.waterPos == 2
  477. ? 0
  478. : item.watermark_info.waterPos == 3
  479. ? 0
  480. : item.watermark_info.waterPos == 4
  481. ? '40%'
  482. : item.watermark_info.waterPos == 5
  483. ? '40%'
  484. : item.watermark_info.waterPos == 6
  485. ? '40%'
  486. : '',
  487. right:
  488. item.watermark_info.waterPos == 3
  489. ? 0
  490. : item.watermark_info.waterPos == 6
  491. ? 0
  492. : item.watermark_info.waterPos == 9
  493. ? 0
  494. : '',
  495. bottom:
  496. item.watermark_info.waterPos == 7
  497. ? 0
  498. : item.watermark_info.waterPos == 8
  499. ? 0
  500. : item.watermark_info.waterPos == 9
  501. ? 0
  502. : '',
  503. fontWeight: item.watermark_info.bold == 1 ? 'bold' : '',
  504. fontFamily:
  505. item.watermark_info.typeface == 1
  506. ? 'typeface1'
  507. : item.watermark_info.typeface == 2
  508. ? 'typeface2'
  509. : item.watermark_info.typeface == 3
  510. ? 'typeface3'
  511. : item.watermark_info.typeface == 4
  512. ? 'typeface4'
  513. : item.watermark_info.typeface == 5
  514. ? 'typeface5'
  515. : item.watermark_info.typeface == 6
  516. ? 'typeface6'
  517. : '',
  518. }"
  519. v-if="
  520. (item.watermark_info && item.watermark_info.type == 2) ||
  521. (item.watermark_info && item.watermark_info.type == 4)
  522. "
  523. >
  524. <view
  525. class=""
  526. :style="{
  527. transform: 'rotate(' + item.watermark_info.angle + 'deg)',
  528. color: `rgba(${hexToRgb(item.watermark_info.color).rgb},${
  529. (100 - item.watermark_info.opacity * 1) * 0.01
  530. })`,
  531. fontSize: item.watermark_info.text_font + 'px',
  532. }"
  533. >
  534. <image
  535. :src="BASE_URL + item.watermark_info.image"
  536. mode=""
  537. v-if="
  538. item.watermark_info.image && item.watermark_info.type == 2
  539. "
  540. ></image>
  541. <text
  542. v-if="
  543. item.watermark_info.water_text &&
  544. item.watermark_info.type == 4
  545. "
  546. style="white-space: nowrap"
  547. >{{ item.watermark_info.water_text }}</text
  548. >
  549. </view>
  550. </view>
  551. </view>
  552. </view>
  553. <u-overlay :show="show" @click="show = false">
  554. <view class="warp">
  555. <view class="rect" @tap.stop>
  556. <image :src="url" mode="widthFix"></image>
  557. <p>长按保存到本地</p>
  558. </view>
  559. </view>
  560. </u-overlay>
  561. <u-popup
  562. :show="showPopup"
  563. :round="10"
  564. mode="bottom"
  565. @close="showPopup = false"
  566. >
  567. <view class="popup">
  568. <view class="popupTop">
  569. <view class="contactInfo">
  570. <p>{{ notice_text }}</p>
  571. </view>
  572. <image :src="BASE_URL + noticeimage" mode=""></image>
  573. </view>
  574. <view class="notice">
  575. <!-- <view class="noticeTitle">
  576. 购买须知
  577. </view> -->
  578. <view class="noticeInfo">
  579. <u-parse :content="buy_notes"></u-parse>
  580. </view>
  581. <view class="popupBottom">
  582. <view class="back" @click="showPopup = false">
  583. <u-icon name="home-fill" color="#fff"></u-icon>
  584. 返回
  585. </view>
  586. </view>
  587. </view>
  588. </view>
  589. </u-popup>
  590. <u-overlay :show="show10" @click="show10 = false">
  591. <view class="warp">
  592. <view class="rect1" @tap.stop>
  593. <image src="../../static/tishi.png" mode=""></image>
  594. <p>该商品已出售或下架</p>
  595. <u-button
  596. color="#A5CF49"
  597. type="success"
  598. shape="circle"
  599. size="large"
  600. text="看看其他斑马账号"
  601. @click="goBack"
  602. ></u-button>
  603. </view>
  604. </view>
  605. </u-overlay>
  606. </view>
  607. </view>
  608. </template>
  609. <script setup>
  610. import limeQrcodeVue from "../../uni_modules/lime-qrcode/components/l-qrcode/l-qrcode.vue";
  611. import html2canvas from "html2canvas";
  612. import { BASE_URL, BASE_URL1 } from "../../utils/http.js";
  613. import { onLoad, onShow, onPullDownRefresh, onReady } from "@dcloudio/uni-app";
  614. import { ref } from "vue";
  615. import {
  616. getGoodsDetail,
  617. getsimpleimages,
  618. getplatformeditor,
  619. getsimpleimagesdetail,
  620. getplatformmeun,
  621. } from "@/utils/api.js";
  622. let show10 = ref(false);
  623. let disclaimer = ref();
  624. let buy_notes = ref();
  625. let notice_text = ref();
  626. let kefu = ref();
  627. let title = ref();
  628. let bg_list = ref({});
  629. let current = ref(0);
  630. let noticeimage = ref();
  631. let jt_bg1 = ref("");
  632. let jt_bg2 = ref("");
  633. onReady(() => {
  634. getplatformmeun().then((res) => {
  635. uni.setNavigationBarTitle({
  636. title: res.data.name,
  637. });
  638. jt_bg1.value = res.data.jt_bg1;
  639. jt_bg2.value = res.data.jt_bg2;
  640. });
  641. });
  642. let swiperChange = (e) => {
  643. current.value = e.current;
  644. };
  645. let swiperClick = (e) => {
  646. uni.previewImage({
  647. // 预览时,默认显示图片的索引
  648. current: current.value,
  649. // 所有图片 url 地址的数组
  650. urls: info.value.images_arr,
  651. });
  652. };
  653. let isLoading = ref(true);
  654. onLoad((option) => {
  655. getplatformeditor().then((res) => {
  656. disclaimer.value = res.data.disclaimer;
  657. notice_text.value = res.data.notice_text;
  658. noticeimage.value = res.data.noticeimage;
  659. buy_notes.value = res.data.buy_notes;
  660. kefu.value = res.data.kfwx;
  661. kefu.value = res.data.kfwx;
  662. });
  663. id.value = option.id;
  664. rand_num.value = option.rand_num;
  665. let images_arr = [];
  666. let index = new Date().getTime();
  667. getGoodsDetail({ goods_id: id.value, rand_num: rand_num.value }).then(
  668. (res) => {
  669. if (res.code == 1) {
  670. bg_list.value = res.data.bg_list;
  671. if (res.data.detail.status == 0) {
  672. show10.value = true;
  673. // return
  674. }
  675. } else {
  676. show10.value = true;
  677. isLoading.value = false;
  678. }
  679. res.data &&
  680. res.data.detail.images_arr.forEach((item) => {
  681. // images_arr.push(BASE_URL+item+"?res="+index)
  682. images_arr.push(BASE_URL + item);
  683. });
  684. info.value = res.data.detail;
  685. info.value.images_arr = images_arr;
  686. getsimpleimagesdetail({ goods_id: info.value.id }).then((res) => {
  687. isLoading.value = false;
  688. res.data.detail = filterDetail(res.data.detail);
  689. item.value = res.data;
  690. // item.value.detail=getspan(item.value.detail)
  691. setTimeout((_) => {
  692. createCanvas();
  693. }, 100);
  694. });
  695. // getsimpleimages().then(res=>{
  696. // let arr=res.data
  697. // arr.forEach(it=>{
  698. // if(info.value.simple_id==it.id){
  699. // item.value=it
  700. // }
  701. // })
  702. // })
  703. }
  704. );
  705. });
  706. function getspan(str) {
  707. var list1 = str.split("</span>");
  708. var list2 = [];
  709. list1.forEach((val) => {
  710. if (val.indexOf("<span") > -1) {
  711. list2.push({
  712. isspan: true,
  713. arr: val.split("<span"),
  714. });
  715. } else {
  716. list2.push({
  717. isspan: false,
  718. arr: val,
  719. });
  720. }
  721. });
  722. var list3 = [];
  723. list2.forEach((val) => {
  724. if (val.isspan) {
  725. list3.push({
  726. ...val,
  727. style: val.arr[1].split(">")[0],
  728. span: val.arr[1].split(">")[1],
  729. });
  730. } else {
  731. list3.push({
  732. ...val,
  733. });
  734. }
  735. });
  736. var html = "";
  737. list3.forEach((val) => {
  738. if (val.isspan) {
  739. html = html + val.arr[0];
  740. var span = "";
  741. for (var a = 0; a < val.span.length; a++) {
  742. span = span + `<span${val.style}>${val.span[a]}</span>`;
  743. }
  744. html = html + span;
  745. } else {
  746. html = html + val.arr;
  747. }
  748. });
  749. return html;
  750. }
  751. onShow(() => {});
  752. let item = ref({});
  753. let info = ref({});
  754. let id = ref("");
  755. let rand_num = ref("");
  756. let showPopup = ref(false);
  757. let swiperHeight = ref(67);
  758. let goBack = () => {
  759. let page = getCurrentPages();
  760. if (page.length == 1) {
  761. uni.switchTab({
  762. url: "/pages/deal/deal",
  763. });
  764. } else {
  765. uni.navigateBack();
  766. }
  767. // console.log('page',page)
  768. };
  769. let show = ref(false);
  770. let takephotos = () => {
  771. // var dom = document.getElementById('swiperItem'); // 获取dom元素
  772. // if(dom&&dom.children[1]){
  773. // swiperHeight.value=67+dom.children[1].clientHeight
  774. // }else{
  775. // swiperHeight.value=67
  776. // }
  777. // html2canvas(dom).then((canvas) => {
  778. // url.value = canvas.toDataURL("image/png");
  779. // show.value = true
  780. // });
  781. // var swiper = document.getElementById('copyswiperItem'); // 获取dom元素
  782. // var dom = document.getElementById('content1'); // 获取dom元素
  783. // var dom1 = document.getElementById('copycontent'); // 获取dom元素
  784. // dom1.innerHTML=dom.innerHTML
  785. // let res = domTrans(dom1)
  786. // // console.log(1223,res)
  787. // let html = forFn(res)
  788. // dom1.innerHTML=html
  789. // html2canvas(swiper,{
  790. // allowTaint: true,
  791. // useCORS: true
  792. // }).then((canvas) => {
  793. // url.value = canvas.toDataURL("image/png").replace('image/png', 'image/octet-stream');
  794. // show.value=true
  795. // });
  796. url.value = canvasValue.value
  797. .toDataURL("image/png")
  798. .replace("image/png", "image/octet-stream");
  799. show.value = true;
  800. };
  801. let url = ref();
  802. let content = `
  803. <p>露从今夜白,月是故乡明</p>
  804. <img src="https://cdn.uviewui.com/uview/swiper/2.jpg" />
  805. `;
  806. let list3 = ref([
  807. "https://cdn.uviewui.com/uview/swiper/swiper3.png",
  808. "https://cdn.uviewui.com/uview/swiper/swiper2.png",
  809. "https://cdn.uviewui.com/uview/swiper/swiper1.png",
  810. ]);
  811. onPullDownRefresh(() => {
  812. setTimeout(function () {
  813. uni.stopPullDownRefresh();
  814. }, 1000);
  815. });
  816. function domTrans(dom) {
  817. // 总dom树
  818. let tree = [];
  819. // 递归, node = 当前的节点,dataNode = 数据插入的节点
  820. const loop = (node, dataNode) => {
  821. // 当前节点的模板
  822. let temp = {
  823. type: node.nodeType,
  824. };
  825. // 如果是文本节点 或 单标签节点
  826. if (temp.type == 3 && node.nodeValue.match(/\S/)) {
  827. temp["content"] = node.nodeValue;
  828. temp["tag"] = node.nodeName;
  829. dataNode.push(temp);
  830. }
  831. // 元素节点
  832. if (temp.type == 1) {
  833. let attributes = getAttribute(node);
  834. // 如果没有属性,不添加 attributes
  835. if (attributes) temp["attributes"] = attributes;
  836. var newNode = node.childNodes;
  837. var newNode2;
  838. if (newNode[0] && newNode.length <= 1) {
  839. newNode2 = newNode[0].childNodes.length;
  840. }
  841. // 当前节点下还有子节点
  842. if (node.childNodes.length > 1 || newNode2 > 0) {
  843. temp["children"] = [];
  844. temp["tag"] = node.nodeName.toLowerCase();
  845. for (let i = 0; i < node.childNodes.length; i++) {
  846. loop(node.childNodes[i], temp.children);
  847. }
  848. }
  849. // 当前节点下只有文本 或 单标签节点
  850. if (node.childNodes.length <= 1 && newNode2 == 0) {
  851. temp["content"] = node.innerHTML;
  852. temp["tag"] = node.nodeName.toLowerCase();
  853. }
  854. dataNode.push(temp);
  855. }
  856. };
  857. loop(dom, tree);
  858. return tree[0].children;
  859. }
  860. function forFn(arr) {
  861. let html = ``;
  862. for (let i = 0; i < arr.length; i++) {
  863. let tArr = [];
  864. if (arr[i].content) {
  865. if (arr[i].content.includes("&nbsp;")) {
  866. let cArr = arr[i].content.split("&nbsp;").map((item) => item.split(""));
  867. let a = cArr.length - 1;
  868. for (let i = 0; i < a; i++) {
  869. cArr.splice(i + 2, 0, "&nbsp;");
  870. }
  871. tArr = cArr.flat();
  872. } else {
  873. tArr = arr[i].content.split("");
  874. }
  875. }
  876. if (arr[i].type === 1) {
  877. if (arr[i].attributes) {
  878. if (arr[i].attributes.src) {
  879. html += `<img class="${arr[i].attributes.class}" src="${arr[i].attributes.src}" style="${arr[i].attributes.style}">`;
  880. } else {
  881. html += `<${arr[i].tag} class="${arr[i].attributes.class}" style="${arr[i].attributes.style}">`;
  882. }
  883. } else {
  884. if (arr[i].tag == "img") {
  885. html += `<${arr[i].tag} style="${arr[i].attributes.style}">`;
  886. } else {
  887. html += `<${arr[i].tag}>`;
  888. }
  889. }
  890. if (arr[i].children) {
  891. html += forFn(arr[i].children);
  892. }
  893. html += `</${arr[i].tag}>`;
  894. }
  895. tArr.forEach((el) => {
  896. if (arr[i].tag === "#text") {
  897. html += `${el}`;
  898. } else {
  899. if (arr[i].attributes) {
  900. if (arr[i].tag == "img") {
  901. html += `<${arr[i].tag} class="${arr[i].attributes.class}" src="${arr[i].attributes.src}" style="${arr[i].attributes.style}">${el}</${arr[i].tag}>`;
  902. } else {
  903. html += `<${arr[i].tag} class="${arr[i].attributes.class}" style="${arr[i].attributes.style}">${el}</${arr[i].tag}>`;
  904. }
  905. } else {
  906. if (arr[i].tag == "img") {
  907. html += `<${arr[i].tag} src="${arr[i].attributes.src}">${el}</${arr[i].tag}>`;
  908. } else {
  909. html += `<${arr[i].tag}>${el}</${arr[i].tag}>`;
  910. }
  911. }
  912. }
  913. });
  914. }
  915. // console.log(html,'====')
  916. return html;
  917. }
  918. function filterDetail(str) {
  919. let detail = str.split('<font style="">');
  920. detail = detail.map((item, index) => {
  921. return !index ? item : item.replace("</font>", "");
  922. });
  923. return detail.join("");
  924. }
  925. // 提取元素属性
  926. function getAttribute(dom) {
  927. let attributes = {};
  928. // let empty = true;
  929. Array.from(dom.attributes).map((item) => {
  930. attributes[item.nodeName] = item.nodeValue;
  931. // empty = false;
  932. });
  933. return attributes;
  934. }
  935. function hexToRgb(val) {
  936. //HEX十六进制颜色值转换为RGB(A)颜色值
  937. // 16进制颜色值的正则
  938. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  939. // 把颜色值变成小写
  940. var color = val.toLowerCase();
  941. var result = "";
  942. if (reg.test(color)) {
  943. // 如果只有三位的值,需变成六位,如:#fff => #ffffff
  944. if (color.length === 4) {
  945. var colorNew = "#";
  946. for (var i = 1; i < 4; i += 1) {
  947. colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
  948. }
  949. color = colorNew;
  950. }
  951. // 处理六位的颜色值,转为RGB
  952. var colorChange = [];
  953. for (var i = 1; i < 7; i += 2) {
  954. colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
  955. }
  956. result = colorChange.join(",");
  957. return {
  958. rgb: result,
  959. r: colorChange[0],
  960. g: colorChange[1],
  961. b: colorChange[2],
  962. };
  963. } else {
  964. result = "无效";
  965. return { rgb: result };
  966. }
  967. }
  968. let canvasValue = ref({});
  969. function createCanvas() {
  970. var swiper = document.getElementById("copyswiperItem"); // 获取dom元素
  971. var dom = document.getElementById("content1"); // 获取dom元素
  972. var dom1 = document.getElementById("copycontent"); // 获取dom元素
  973. dom1.innerHTML = dom.innerHTML;
  974. let res = domTrans(dom1);
  975. let html = forFn(res);
  976. dom1.innerHTML = html;
  977. html2canvas(swiper, {
  978. allowTaint: true,
  979. useCORS: true,
  980. ignoreElements: (e) => {
  981. if (e.contains(swiper) || swiper.contains(e)) {
  982. return false;
  983. }
  984. return true;
  985. },
  986. }).then((canvas) => {
  987. canvasValue.value = canvas;
  988. });
  989. }
  990. </script>
  991. <style lang="scss">
  992. .fontWeight {
  993. font-weight: bold;
  994. color: #000;
  995. font-size: 30rpx;
  996. }
  997. .warp {
  998. padding: 0 28rpx;
  999. display: flex;
  1000. align-items: center;
  1001. justify-content: center;
  1002. height: 100%;
  1003. }
  1004. .rect1 {
  1005. padding: 60rpx 120rpx;
  1006. display: flex;
  1007. flex-direction: column;
  1008. align-items: center;
  1009. width: 558rpx;
  1010. height: 438rpx;
  1011. background: #ffffff;
  1012. border-radius: 20rpx;
  1013. image {
  1014. width: 96rpx;
  1015. height: 96rpx;
  1016. }
  1017. p {
  1018. font-size: 30rpx;
  1019. margin: 62rpx 0 40rpx;
  1020. }
  1021. // background-color: #fff;
  1022. }
  1023. .labelBox {
  1024. padding: 0 15px;
  1025. margin: 10rpx 0;
  1026. display: flex;
  1027. flex-wrap: wrap;
  1028. .labelItem {
  1029. margin-right: 20rpx;
  1030. margin-bottom: 5rpx;
  1031. font-size: 20rpx;
  1032. color: #fff;
  1033. border-radius: 30rpx;
  1034. padding: 7rpx 16rpx;
  1035. background-position: center center;
  1036. background-repeat: no-repeat;
  1037. background-size: cover;
  1038. // background-color: #A5CF49;
  1039. }
  1040. }
  1041. .content {
  1042. padding-left: 10rpx;
  1043. padding-right: 10rpx;
  1044. overflow: hidden;
  1045. position: relative;
  1046. word-break: break-all;
  1047. word-wrap: break-word;
  1048. overflow: hidden;
  1049. position: relative;
  1050. .watermark {
  1051. display: flex;
  1052. flex-wrap: wrap;
  1053. position: absolute;
  1054. top: 0;
  1055. left: 0;
  1056. right: 0;
  1057. // bottom: 0;
  1058. image {
  1059. width: 100rpx;
  1060. height: 100rpx;
  1061. }
  1062. }
  1063. .watermark1 {
  1064. position: absolute;
  1065. image {
  1066. width: 100rpx;
  1067. height: 100rpx;
  1068. }
  1069. }
  1070. }
  1071. .popup {
  1072. overflow: hidden;
  1073. .notice {
  1074. padding: 24rpx 28rpx;
  1075. font-size: 28rpx;
  1076. .noticeTitle {
  1077. font-weight: bold;
  1078. text-align: center;
  1079. }
  1080. .noticeInfo {
  1081. height: 500rpx;
  1082. overflow: scroll;
  1083. }
  1084. }
  1085. .popupBottom {
  1086. display: flex;
  1087. justify-content: right;
  1088. padding: 20rpx 28rpx;
  1089. height: 160rpx;
  1090. .back {
  1091. display: flex;
  1092. justify-content: center;
  1093. text-align: center;
  1094. font-size: 28rpx;
  1095. color: #fff;
  1096. width: 162rpx;
  1097. height: 80rpx;
  1098. line-height: 80rpx;
  1099. background: #a5cf49;
  1100. border-radius: 40rpx;
  1101. }
  1102. }
  1103. .popupTop {
  1104. border-radius: 20rpx 20rpx 0rpx 0rpx;
  1105. display: flex;
  1106. justify-content: space-between;
  1107. align-items: center;
  1108. padding: 26rpx;
  1109. background: linear-gradient(135deg, #f9ffe9 0%, #ddffda 100%);
  1110. .contactInfo {
  1111. flex: 1;
  1112. font-size: 36rpx;
  1113. }
  1114. image {
  1115. width: 160rpx;
  1116. height: 160rpx;
  1117. }
  1118. }
  1119. }
  1120. .warp {
  1121. padding: 0 28rpx;
  1122. display: flex;
  1123. align-items: center;
  1124. justify-content: center;
  1125. height: 100%;
  1126. }
  1127. .rect {
  1128. display: flex;
  1129. flex-direction: column;
  1130. align-items: center;
  1131. width: 694px;
  1132. height: auto;
  1133. image {
  1134. width: 100%;
  1135. }
  1136. p {
  1137. font-size: 48rpx;
  1138. color: #fff;
  1139. margin-top: 12rpx;
  1140. }
  1141. // background-color: #fff;
  1142. }
  1143. .swiper-item {
  1144. position: fixed;
  1145. top: 9999px;
  1146. .titleBox {
  1147. font-size: 28rpx;
  1148. color: #666666;
  1149. padding: 6rpx;
  1150. background: #fff5e5;
  1151. display: flex;
  1152. align-items: flex-end;
  1153. image {
  1154. margin-right: 4rpx;
  1155. width: 112rpx;
  1156. height: 112rpx;
  1157. }
  1158. .warn {
  1159. font-size: 32rpx;
  1160. color: #ff2828;
  1161. }
  1162. .title {
  1163. margin-left: 4rpx;
  1164. }
  1165. }
  1166. }
  1167. .tabbar {
  1168. bottom: 0;
  1169. padding: 20rpx 28rpx;
  1170. position: fixed;
  1171. width: 750rpx;
  1172. height: 160rpx;
  1173. background: #ffffff;
  1174. display: flex;
  1175. justify-content: space-between;
  1176. .back {
  1177. display: flex;
  1178. justify-content: center;
  1179. font-size: 28rpx;
  1180. color: #fff;
  1181. width: 162rpx;
  1182. height: 80rpx;
  1183. text-align: center;
  1184. line-height: 80rpx;
  1185. background: #a5cf49;
  1186. border-radius: 40rpx;
  1187. }
  1188. .price {
  1189. line-height: 80rpx;
  1190. font-size: 24rpx;
  1191. color: #333333;
  1192. text {
  1193. color: #ff2828;
  1194. }
  1195. .bold {
  1196. font-weight: bold;
  1197. font-size: 40rpx;
  1198. }
  1199. }
  1200. }
  1201. .productInfo {
  1202. margin-bottom: 10rpx;
  1203. background-color: #fff;
  1204. padding: 20rpx 32rpx;
  1205. .infoTitle {
  1206. margin-bottom: 10rpx;
  1207. font-size: 28rpx;
  1208. font-weight: bold;
  1209. }
  1210. .statement {
  1211. font-size: 24rpx;
  1212. }
  1213. }
  1214. .label {
  1215. padding: 24rpx 32rpx;
  1216. background-color: #fff;
  1217. margin: 10rpx 0;
  1218. .u-fade-enter-active {
  1219. margin-right: 20rpx;
  1220. }
  1221. }
  1222. page {
  1223. padding-bottom: 170rpx;
  1224. .attributeBox {
  1225. font-size: 28rpx;
  1226. color: #666666;
  1227. .attributeItem {
  1228. margin-top: 20rpx;
  1229. display: flex;
  1230. .labelItem {
  1231. flex: 1;
  1232. }
  1233. }
  1234. }
  1235. .baseInfo {
  1236. background-color: #fff;
  1237. padding: 22rpx 30rpx;
  1238. .titleBox {
  1239. display: flex;
  1240. justify-content: space-between;
  1241. .wechat {
  1242. font-size: 40rpx;
  1243. color: #1677ff;
  1244. font-weight: bold;
  1245. }
  1246. .takeImg {
  1247. width: 206rpx;
  1248. height: 52rpx;
  1249. line-height: 52rpx;
  1250. background: #a5cf49;
  1251. border-radius: 40rpx;
  1252. font-size: 28rpx;
  1253. color: #ffff;
  1254. font-weight: bold;
  1255. text-align: center;
  1256. }
  1257. }
  1258. }
  1259. }
  1260. </style>