detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <My_listbox ref="List" @getlist="getDetail">
  3. <swiper class="swiper" circular v-if="slides.length" :indicator-dots="slides.length > 1" indicator-color="#DC808B"
  4. indicator-active-color="#C30D23">
  5. <swiper-item class="swiper-item" v-for="item in slides" :key="item.url">
  6. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
  7. <view class="qrcode" @click="saveQrcode">
  8. <text class="iconfont icon-xiazai" />
  9. 二维码
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. <view class="head">
  14. <view class="line1">
  15. <view class="left">
  16. <text class="iconfont icon-biaoqian" />
  17. {{ detail.renderingstype }}
  18. </view>
  19. <view class="right" hover-class="navigator-hover"
  20. @click="collectLoading ? '' : handleCollect(detail.iscollect)">
  21. <u-loading-icon v-if="collectLoading" size="20" />
  22. <block v-else>
  23. <text v-if="detail.iscollect == 0" class="iconfont icon-weishoucang" />
  24. <text v-else class="iconfont icon-yishoucang" style="color: #FFC300;" />
  25. 收藏
  26. </block>
  27. </view>
  28. </view>
  29. <view class="title">{{ detail.title }}</view>
  30. <view class="subtitle" v-if="detail.subtitle">{{ detail.subtitle }}</view>
  31. </view>
  32. <scroll-view v-if="productList.length" class="product-list" scroll-x lower-threshold="200" enable-flex
  33. @scrolltolower="scrolltolower">
  34. <navigator class="product" v-for="item in productList" :key="item.sa_fadid"
  35. :url="'/packageCase/product/detail?id=' + item.sa_fadid" hover-class="navigator-hover">
  36. <u--image :src="item.cover" :lazy-load="true" :width="tovw(112)" :height="tovw(112)" radius="5">
  37. <template v-slot:loading>
  38. <u-loading-icon color="red"></u-loading-icon>
  39. </template>
  40. </u--image>
  41. <view class="label u-line-1">
  42. {{ item.name }}
  43. </view>
  44. </navigator>
  45. </scroll-view>
  46. <view class="introduce" v-if="detail.notes">
  47. <view class="introduce-title">
  48. 产品介绍
  49. </view>
  50. <view class="introduce-text">
  51. {{ detail.notes }}
  52. </view>
  53. </view>
  54. <storeInfo />
  55. <view style="position: absolute;z-index: -999;top: 0;">
  56. <l-painter ref="painter" hidden css="padding:10px;background:#fff;width: 148px;">
  57. <l-painter-view>
  58. <l-painter-view css="margin: 0 auto;width: 128px;">
  59. <l-painter-qrcode :text="detail.appleturl" css="width: 128px; height: 128px;color:#000;" />
  60. </l-painter-view>
  61. <l-painter-view css="width: 108px;text-align: center;margin: 10px auto 0;">
  62. <l-painter-text :text="detail.title" />
  63. </l-painter-view>
  64. </l-painter-view>
  65. </l-painter>
  66. </view>
  67. <bottomForm />
  68. </My_listbox>
  69. </template>
  70. <script>
  71. import bottom1 from "../../components/bottomModules/bottom1.vue"
  72. import lPainter from "../../uni_modules/lime-painter/components/l-painter/l-painter.vue"
  73. import lPainterText from "../../uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue"
  74. import lPainterView from "../../uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue"
  75. import lPainterQrcode from "../../uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue"
  76. export default {
  77. components: { bottom1, lPainter, lPainterQrcode, lPainterText, lPainterView },
  78. data() {
  79. return {
  80. sat_sharematerialid: null,
  81. detail: {},
  82. slides: [],
  83. collectLoading: false,
  84. content: {
  85. "pageNumber": 1,
  86. "pageTotal": 1,
  87. "pageSize": 20,
  88. "where": {
  89. "condition": ""
  90. }
  91. },
  92. productList: []
  93. }
  94. },
  95. onLoad(options) {
  96. this.sat_sharematerialid = options.id;
  97. this.getDetail(true);
  98. this.scrolltolower()
  99. },
  100. methods: {
  101. getDetail(init = false) {
  102. if (!init) return;
  103. this.$Http.basic({
  104. "id": 20240415164302,
  105. "content": {
  106. "sat_sharematerialid": this.sat_sharematerialid
  107. },
  108. }).then(res => {
  109. this.$refs.List.RefreshToComplete()
  110. console.log("获取效果图详情", res)
  111. if (this.cutoff(res.msg)) return;
  112. this.detail = res.data;
  113. this.slides = res.data.attinfos_pic.map(v => {
  114. return {
  115. cover: this.getSpecifiedImage(v.attinfos[0], 'compressed'),
  116. url: v.attinfos[0].url
  117. }
  118. })
  119. uni.setNavigationBarTitle({
  120. title: res.data.title
  121. });
  122. })
  123. },
  124. handleCollect(iscollect) {
  125. this.collectLoading = true;
  126. this.$Http.basic({
  127. "id": 20240416133702,
  128. "content": {
  129. "ownertable": "sat_sharematerial",
  130. "ownerid": this.detail.sat_sharematerialid,
  131. "type": 1
  132. },
  133. }).then(res => {
  134. console.log("收藏", res)
  135. this.collectLoading = false;
  136. if (this.cutoff(res.msg)) return;
  137. this.detail.iscollect = iscollect ? 0 : 1
  138. })
  139. },
  140. saveQrcode() {
  141. let that = this;
  142. that.$refs.painter.canvasToTempFilePathSync({
  143. fileType: "jpg",
  144. // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
  145. pathType: 'url',
  146. quality: 1,
  147. success: (res) => {
  148. console.log(res.tempFilePath);
  149. // 非H5 保存到相册
  150. // H5 提示用户长按图另存
  151. uni.saveImageToPhotosAlbum({
  152. filePath: res.tempFilePath,
  153. success: function (e) {
  154. uni.showModal({
  155. title: '提示',
  156. content: '图片已保存到系统相册',
  157. showCancel: false
  158. })
  159. that.loading = false;
  160. },
  161. fail: ({ errMsg }) => {
  162. if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
  163. uni.showModal({
  164. title: '提示',
  165. content: '请授权添加到相册权限后再试!',
  166. showCancel: false,
  167. complete: (complete) => {
  168. uni.openSetting({
  169. success: res => {
  170. that.loading = false;
  171. if (res.authSetting['scope.writePhotosAlbum']) {
  172. this.saveTheImage()
  173. } else {
  174. uni.showModal({
  175. title: '提示',
  176. content: '未获取授权!已取消保存',
  177. showCancel: false,
  178. })
  179. }
  180. }
  181. })
  182. },
  183. })
  184. } else {
  185. that.loading = false;
  186. uni.showModal({
  187. title: '提示',
  188. content: '已取消保存',
  189. showCancel: false,
  190. })
  191. }
  192. },
  193. });
  194. },
  195. });
  196. },
  197. getSheraDate() {
  198. let detail = this.detail
  199. return {
  200. title: detail.title, // 标题
  201. path: "/packageCase/imgs/detail?id=" + detail.sat_sharematerialid, // 分享路径
  202. imageUrl: this.detail.attinfos.find(v => v.usetype == "sat_sharematerial").url || ""// 分享图
  203. };
  204. },
  205. scrolltolower() {
  206. let content = this.content;
  207. content.sat_sharematerialid = this.sat_sharematerialid;
  208. if (content.pageNumber > content.pageTotal) return console.log("已加载全部单品")
  209. this.$Http.basic({
  210. "id": 20240419135802,
  211. content
  212. }).then(res => {
  213. console.log("关联单品", res)
  214. if (this.cutoff(res.msg)) return;
  215. res.data = res.data.map(v => {
  216. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "sa_fad") || v.attinfos[0]) : uni.getStorageSync("site").logo || ''
  217. return v
  218. })
  219. this.productList = res.pageNumber == 1 ? res.data : this.productList.concat(res.data);
  220. content.pageNumber = res.pageNumber + 1;
  221. content.pageTotal = res.pageTotal;
  222. })
  223. }
  224. },
  225. onShareAppMessage(res) {
  226. return this.getSheraDate()
  227. },
  228. onShareTimeline() {
  229. return this.getSheraDate()
  230. }
  231. }
  232. </script>
  233. <style lang="scss">
  234. .swiper {
  235. width: 375px;
  236. height: 231px;
  237. background: #F5F5F5;
  238. border-radius: 5px;
  239. box-sizing: border-box;
  240. .swiper-item {
  241. position: relative;
  242. width: 100%;
  243. height: 100%;
  244. .image {
  245. width: 100%;
  246. height: 100%;
  247. }
  248. .qrcode {
  249. position: absolute;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. top: 10px;
  254. right: 10px;
  255. width: 70px;
  256. height: 25px;
  257. background: rgba($color: #333333, $alpha: 0.5);
  258. font-size: 12px;
  259. color: #FFFFFF;
  260. .iconfont {
  261. margin-right: 4px;
  262. }
  263. }
  264. }
  265. }
  266. .head {
  267. background: #fff;
  268. padding: 8px 10px 15px;
  269. margin-bottom: 10px;
  270. .line1 {
  271. display: flex;
  272. justify-content: space-between;
  273. align-items: flex-end;
  274. .left {
  275. .iconfont {
  276. margin-right: 4px;
  277. font-size: 12px;
  278. }
  279. line-height: 17px;
  280. font-size: 12px;
  281. color: #999999;
  282. }
  283. .right {
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. width: 80px;
  288. height: 24px;
  289. border-radius: 12px;
  290. border: 1px solid #CCCCCC;
  291. font-family: PingFang SC, PingFang SC;
  292. font-size: 12px;
  293. color: #333333;
  294. .iconfont {
  295. margin-right: 5px;
  296. }
  297. }
  298. }
  299. .title {
  300. line-height: 20px;
  301. font-family: PingFang SC, PingFang SC;
  302. font-weight: bold;
  303. font-size: 14px;
  304. color: #333333;
  305. margin: 10px 0;
  306. }
  307. .subtitle {
  308. line-height: 17px;
  309. font-family: PingFang SC, PingFang SC;
  310. font-size: 12px;
  311. color: #666666;
  312. }
  313. }
  314. .product-list {
  315. display: flex;
  316. width: 100vw;
  317. height: 162px;
  318. white-space: nowrap;
  319. box-sizing: border-box;
  320. padding-top: 10px;
  321. background: #fff;
  322. margin-bottom: 10px;
  323. .product {
  324. width: 112px;
  325. height: 142px;
  326. margin-left: 10px;
  327. flex-shrink: 0;
  328. background: #fff;
  329. .label {
  330. width: 112px;
  331. line-height: 20px;
  332. font-family: PingFang SC, PingFang SC;
  333. font-size: 14px;
  334. color: #333333;
  335. margin-top: 10px;
  336. white-space: Normal;
  337. }
  338. }
  339. }
  340. .introduce {
  341. background: #fff;
  342. padding: 0 10px;
  343. &-title {
  344. line-height: 45px;
  345. background: #FFFFFF;
  346. font-family: PingFang SC, PingFang SC;
  347. font-weight: bold;
  348. font-size: 16px;
  349. color: #333333;
  350. }
  351. &-text {
  352. line-height: 20px;
  353. font-family: PingFang SC, PingFang SC;
  354. font-size: 14px;
  355. color: #333333;
  356. padding-bottom: 10px;
  357. }
  358. }
  359. </style>