app-diy-page.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. <template>
  2. <view class="app-diy-page" :style="shareFixed?'padding-top:124rpx':''" v-bind:class="mp_link_top ? 'mp_link_top' : ''">
  3. <view class="nav-bar dir-left-nowrap" v-bind:class="mp_link_top ? 'mp_link_top' : ''" v-if="newData.show_navs == 1">
  4. <block v-for="(nav, index) in newData.navs" :key="index">
  5. <view class="nav-bar-one cross-center box-grow-0"
  6. v-bind:class="nav_active === index ? 'active ' + theme + '-m-text ' + theme : ''"
  7. v-on:click='changeNav(index)'
  8. >
  9. {{nav.name}}
  10. </view>
  11. </block>
  12. </view>
  13. <view class="diy-template">
  14. <block v-for="(item, index) in newData.navs" :key="index">
  15. <template v-if="nav_active === index">
  16. <block v-for="(temp, temp_index) in item.template.data" :key="temp_index">
  17. <template v-if="temp.id === 'background'">
  18. <view
  19. class="app-diy-bg"
  20. :style="[
  21. {'background-color':`${temp.data.backgroundColor}`,
  22. 'background-image': temp.data.backgroundPicUrl ? `url(${temp.data.backgroundPicUrl})` : `none`,
  23. 'background-size':`${temp.data.backgroundWidth + '% ' + temp.data.backgroundHeight + '%'}`,
  24. 'background-position':`${transLabelBackgroundPosition(temp.data.position)}`,
  25. 'background-repeat':`${transLabelBackgroundRepeat(temp.data.mode)}`}
  26. ]"
  27. ></view>
  28. </template>
  29. <!--搜索-->
  30. <template v-else-if="temp.id === 'search'">
  31. <app-search-for v-bind:value="temp.data"></app-search-for>
  32. </template>
  33. <!--轮播图-->
  34. <template v-else-if="temp.id === 'banner'">
  35. <template v-if="temp.data.banners.length > 0">
  36. <view :style="{height: temp.data.height + 'rpx'}" v-if="temp.data.effect == 1 || !temp.data.effect">
  37. <app-swiper
  38. :list="temp.data.banners"
  39. :autoplay="temp.data.autoplay === 0 ? true : false"
  40. name="pic_url"
  41. :effect3d="temp.data.style === 2 ? true : false"
  42. :height="temp.data.height"
  43. :effect3dPreviousMargin="50"
  44. :imgMode="temp.data.fill === 0 ? 'aspectFit' : 'scaleToFill'"
  45. :interval="temp.data.interval ? temp.data.interval : 3000"
  46. :duration="temp.data.duration ? temp.data.duration : 500"
  47. :mode="temp.data.mode"
  48. ></app-swiper>
  49. </view>
  50. <view :style="{height: temp.data.height + 'rpx'}" v-if="temp.data.effect == 2">
  51. <u-swiper
  52. :list="temp.data.banners"
  53. name="pic_url"
  54. :height="temp.data.height"
  55. :interval="temp.data.interval ? temp.data.interval : 3000"
  56. :duration="temp.data.duration ? temp.data.duration : 500"
  57. :mode="temp.data.mode"
  58. :imgMode="temp.data.fill === 0 ? 'aspectFit' : 'scaleToFill'"
  59. :autoplay="temp.data.autoplay === 0 ? true : false"
  60. >
  61. </u-swiper>
  62. </view>
  63. </template>
  64. </template>
  65. <!-- 普通商品列表 -->
  66. <template v-else-if="temp.id === 'goods'">
  67. <view
  68. :style="[
  69. {'background-color':`${temp.data.backgroundColor}`,
  70. 'background-image': temp.data.backgroundPicUrl ? `url(${temp.data.backgroundPicUrl})` : `none`,
  71. 'background-size':`${temp.data.backgroundWidth + '% ' + temp.data.backgroundHeight + '%'}`,
  72. 'background-position':`${transLabelBackgroundPosition(temp.data.position)}`,
  73. 'background-repeat':`${transLabelBackgroundRepeat(temp.data.mode)}`}
  74. ]">
  75. <!--排序-->
  76. <view class="goods-rank">
  77. <view class="item" :class="rr.is_choose?'active':''" v-for="(rr,rrindex) in goods_rank"
  78. :key="rrindex" @click="changeRank(rr,temp.data.list)">
  79. <text>{{rr.name}}</text>
  80. <image :src="rr[rr.rank_type+'_img']"
  81. v-if="rr.is_rank"></image>
  82. </view>
  83. </view>
  84. <template v-if="temp.data.catPosition === 'top'">
  85. <u-ordinary-list
  86. v-bind:theme="theme"
  87. v-bind:show-cat="temp.data.showCat"
  88. v-bind:cat-list="temp.data.catList"
  89. v-bind:cat-style="temp.data.catStyle"
  90. v-bind:list="temp.data.list"
  91. v-bind:list-style="temp.data.listStyle"
  92. v-bind:goods-style="temp.data.goodsStyle"
  93. v-bind:goods-tag-pic-url="temp.data.goodsTagPicUrl"
  94. v-bind:goods-cover-proportion="temp.data.goodsCoverProportion"
  95. v-bind:show-goods-tag="temp.data.showGoodsTag"
  96. v-bind:show-goods-name="temp.data.showGoodsName"
  97. v-bind:show-goods-price="temp.data.showGoodsPrice"
  98. v-bind:show-buy-btn="temp.data.showBuyBtn"
  99. v-bind:buy-btn="temp.data.buyBtn"
  100. v-bind:buy-btn-style="temp.data.buyBtnStyle"
  101. v-bind:buy-btn-text="temp.data.buyBtnText"
  102. v-bind:button-color="temp.data.buttonColor"
  103. v-bind:text-style="temp.data.textStyle"
  104. v-bind:is-under-line-price="temp.data.isUnderLinePrice"
  105. v-bind:fill="temp.data.fill"
  106. v-bind:isDIY="true"
  107. v-on:buyProduct="buyProduct"
  108. :theme-object="themeObject"
  109. >
  110. </u-ordinary-list>
  111. </template>
  112. <template v-else>
  113. <app-recommended-product-list
  114. v-bind:show-cat="temp.data.showCat"
  115. v-bind:show-buy-btn="temp.data.showBuyBtn"
  116. v-bind:cat-style="temp.data.catStyle"
  117. v-bind:cat-list="temp.data.catList"
  118. v-bind:list="temp.data.list" :list-style="temp.data.listStyle"
  119. v-bind:goods-cover-proportion="temp.data.goodsCoverProportion"
  120. v-bind:fill="temp.data.fill" :goods-style="temp.data.goodsStyle"
  121. v-bind:show-goods-name="temp.data.showGoodsName"
  122. v-bind:show-goods-price="temp.data.showGoodsPrice"
  123. v-bind:buy-btn="temp.data.buyBtn" :sign="temp.id"
  124. v-bind:buy-btn-style="temp.data.buyBtnStyle"
  125. v-bind:buy-btn-text="temp.data.buyBtnText"
  126. v-bind:show-goods-tag="temp.data.showGoodsTag"
  127. v-bind:customize-goods-tag="temp.data.customizeGoodsTag"
  128. v-bind:goods-tag-pic-url="temp.data.goodsTagPicUrl"
  129. v-bind:button-color="temp.data.buttonColor"
  130. v-bind:is-under-line-price="temp.data.isUnderLinePrice"
  131. v-bind:theme="theme"
  132. v-bind:cat-position="temp.data.catPosition"
  133. ></app-recommended-product-list>
  134. </template>
  135. </view>
  136. </template>
  137. <!-- 插件商品列表 -->
  138. <template v-else-if="temp.id === 'pintuan'
  139. || temp.id === 'miaosha'
  140. || temp.id === 'advance'
  141. || temp.id === 'booking'
  142. || temp.id === 'bargain'
  143. || temp.id === 'pick'
  144. || temp.id === 'lottery'
  145. || temp.id === 'integral-mall'
  146. || temp.id === 'gift'
  147. || temp.id === 'exchange'
  148. || temp.id === 'composition'
  149. || temp.id === 'flash-sale'
  150. || temp.id === 'wholesale'">
  151. <view :style="[
  152. {'background-color':`${temp.data.backgroundColor}`,
  153. 'background-image': temp.data.backgroundPicUrl ? `url(${temp.data.backgroundPicUrl})` : `none`,
  154. 'background-size':`${temp.data.backgroundWidth + '% ' + temp.data.backgroundHeight + '%'}`,
  155. 'background-position':`${transLabelBackgroundPosition(temp.data.position)}`,
  156. 'background-repeat':`${transLabelBackgroundRepeat(temp.data.mode)}`}]"
  157. >
  158. <template v-if="temp.id === 'integral-mall' && temp.data.showCoupon">
  159. <app-exclusive-coupon
  160. v-bind:none-color="true"
  161. v-bind:list="temp.data.coupon_list"
  162. v-bind:sign="temp.id"
  163. v-bind:text-color="temp.data.couponColor"
  164. v-bind:show-top="false"
  165. v-bind:coupon_req="coupon_req"
  166. v-bind:unclaimed-bg="temp.data.couponPicUrl"
  167. ></app-exclusive-coupon>
  168. </template>
  169. <app-diy-goods-list
  170. v-bind:show-buy-btn="temp.data.showBuyBtn"
  171. v-bind:list="temp.data.list"
  172. v-bind:list-style="temp.data.listStyle"
  173. v-bind:goods-cover-proportion="temp.data.goodsCoverProportion"
  174. v-bind:fill="temp.data.fill"
  175. v-bind:goods-style="temp.data.goodsStyle"
  176. v-bind:show-goods-name="temp.data.showGoodsName"
  177. v-bind:text-style="temp.data.textStyle"
  178. v-bind:sign="temp.id"
  179. v-bind:button-color="temp.data.buttonColor"
  180. v-bind:buy-btn-style="temp.data.buyBtnStyle"
  181. v-bind:buy-btn-text="temp.data.buyBtnText"
  182. v-bind:show-goods-tag="temp.data.showGoodsTag"
  183. v-bind:page-hide="pageHide"
  184. v-bind:show-progress-bar="temp.data.showProgressBar"
  185. v-bind:customize-goods-tag="temp.data.customizeGoodsTag"
  186. v-bind:is-under-line-price="temp.data.isUnderLinePrice"
  187. v-bind:goods-tag-pic-url="temp.data.goodsTagPicUrl"
  188. v-bind:theme="theme"
  189. ></app-diy-goods-list>
  190. </view>
  191. </template>
  192. <template v-else-if="temp.id === 'rubik'">
  193. <view style="position: relative">
  194. <app-image-ad
  195. v-bind:image-style="temp.data.style"
  196. v-bind:list="temp.data.list"
  197. v-bind:height="temp.data.height"
  198. ></app-image-ad>
  199. <block v-for="(hotspot, hotspot_index) in temp.data.hotspot" v-bind:key="hotspot_index">
  200. <app-hotspot v-bind:hotspot="rubikHotspot(hotspot)"></app-hotspot>
  201. </block>
  202. </view>
  203. </template>
  204. <template v-else-if="temp.id === 'notice'">
  205. <u-announcement
  206. v-bind:bgColor="temp.data.background"
  207. v-bind:btn-color="temp.data.btnColor"
  208. v-bind:btn-height="temp.data.btnHeight"
  209. v-bind:btn-radius="`${temp.data.btnRadius}rpx`"
  210. v-bind:btn-text="temp.data.btnText"
  211. v-bind:btn-text-color="temp.data.btnTextColor"
  212. v-bind:btn-width="temp.data.btnWidth"
  213. v-bind:content="temp.data.content"
  214. v-bind:header-url="temp.data.headerUrl"
  215. v-bind:icon="temp.data.icon"
  216. v-bind:name="temp.data.name"
  217. v-bind:textColor="temp.data.textColor"
  218. ></u-announcement>
  219. </template>
  220. <template v-else-if="temp.id === 'nav'">
  221. <!-- 新数据 -->
  222. <template v-if="temp.data.modeType">
  223. <app-navigation-two-icon
  224. v-bind:mode-type="temp.data.modeType"
  225. v-bind:background="temp.data.backgroundColor"
  226. v-bind:color="temp.data.color"
  227. v-bind:navs="temp.data.navs"
  228. v-bind:columns="temp.data.columns"
  229. v-bind:temp-index="temp_index"
  230. v-bind:nav-type="temp.data.navType"
  231. v-bind:alone-num="temp.data.aloneNum"
  232. v-bind:line-num="temp.data.lineNum"
  233. v-bind:swiper-type="temp.data.swiperType"
  234. v-bind:swiper-color="temp.data.swiperColor"
  235. v-bind:swiper-no-color="temp.data.swiperNoColor"
  236. ></app-navigation-two-icon>
  237. </template>
  238. <!-- 老数据 -->
  239. <template v-else>
  240. <view
  241. :style="[
  242. {'background-color':`${temp.data.backgroundColor}`,
  243. 'background-image': temp.data.backgroundPicUrl ? `url(${temp.data.backgroundPicUrl})` : `none`,
  244. 'background-size':`${temp.data.backgroundWidth + '% ' + temp.data.backgroundHeight + '%'}`,
  245. 'background-position':`${transLabelBackgroundPosition(temp.data.position)}`,
  246. 'background-repeat':`${transLabelBackgroundRepeat(temp.data.mode)}`}]"
  247. >
  248. <app-navigation-icon
  249. v-bind:background="''"
  250. v-bind:color="temp.data.color"
  251. v-bind:rows="temp.data.rows"
  252. v-bind:columns="temp.data.columns"
  253. v-bind:scroll="temp.data.scroll"
  254. v-bind:navs="temp.data.navs"
  255. ></app-navigation-icon>
  256. </view>
  257. </template>
  258. </template>
  259. <template v-else-if="temp.id === 'video'">
  260. <app-video :pic-url="temp.data.pic_url" :url="temp.data.url"></app-video>
  261. </template>
  262. <template v-else-if="temp.id === 'link'">
  263. <app-associated-link
  264. v-bind:arrows-switch="temp.data.arrowsSwitch"
  265. v-bind:background="temp.data.background"
  266. v-bind:color="temp.data.color"
  267. v-bind:position="temp.data.position"
  268. v-bind:style-color="temp.data.styleColor"
  269. v-bind:link="Object.assign({}, temp.data.link)"
  270. v-bind:styleNum="temp.data.style"
  271. v-bind:pic-switch="temp.data.picSwitch"
  272. v-bind:pic-url="temp.data.picUrl"
  273. v-bind:font-size="temp.data.fontSize"
  274. v-bind:title="temp.data.title"
  275. ></app-associated-link>
  276. </template>
  277. <template v-else-if="temp.id === 'topic'">
  278. <template v-if="temp.data.style === 'normal'">
  279. <app-special-topic
  280. v-bind:count="temp.data.count"
  281. v-bind:icon="temp.data.icon"
  282. v-bind:logo_1="temp.data.logo_1"
  283. v-bind:logo_2="temp.data.logo_2"
  284. v-bind:topic_list="temp.data.topic_list"
  285. ></app-special-topic>
  286. </template>
  287. <template v-else-if="temp.data.style === 'list'">
  288. <app-special-topic-list
  289. v-bind:cat-show="temp.data.cat_show"
  290. v-bind:list="temp.data.list"
  291. v-bind:theme="theme"
  292. v-bind:topic-list="temp.data.topic_list"
  293. ></app-special-topic-list>
  294. </template>
  295. </template>
  296. <template v-else-if="temp.id === 'store'">
  297. <app-shop
  298. v-bind:list="temp.data.list"
  299. v-bind:nav-pic-url="temp.data.navPicUrl"
  300. v-bind:score-pic-url="temp.data.scorePicUrl"
  301. v-bind:show-name="temp.data.showName"
  302. v-bind:show-score="temp.data.showScore"
  303. v-bind:show-tel="temp.data.showTel"
  304. v-bind:scrollTop="scrollTop"
  305. ></app-shop>
  306. </template>
  307. <template v-else-if="temp.id === 'copyright'">
  308. <app-copyright
  309. v-bind:background-color="temp.data.backgroundColor"
  310. v-bind:text="temp.data.text"
  311. v-bind:pic-url="temp.data.picUrl"
  312. v-bind:link="temp.data.link"
  313. ></app-copyright>
  314. </template>
  315. <template v-else-if="temp.id === 'user-info'">
  316. <app-user-center
  317. v-bind:top-pic-url="temp.data.backgroundPicUrl"
  318. v-bind:member-pic-url="userCenter.member_pic_url"
  319. v-bind:top-style="temp.data.style"
  320. ></app-user-center>
  321. </template>
  322. <template v-else-if="temp.id === 'user-order'">
  323. <app-my-order
  324. v-bind:order_bar="temp.data.navs"
  325. v-bind:background-color="temp.data.backgroundColor"
  326. v-bind:theme="theme"
  327. ></app-my-order>
  328. </template>
  329. <!-- 优惠券 -->
  330. <template v-else-if="temp.id === 'coupon'">
  331. <app-exclusive-coupon-two
  332. background="#FFFFFF"
  333. v-bind:list="temp.data.coupon_list"
  334. v-bind:receive-bg="temp.data.receiveBg"
  335. v-bind:text-color="temp.data.textColor"
  336. v-bind:unclaimed-bg="temp.data.unclaimedBg"
  337. v-bind:coupon_req="coupon_req"
  338. v-bind:coupon-bg="temp.data.couponBg ? temp.data.couponBg : `#D9BC8B`"
  339. v-bind:coupon-bg-type="temp.data.couponBgType"
  340. v-bind:add-type="temp.data.addType"
  341. v-bind:page_id="page_id"
  342. v-bind:template_id="item.template_id"
  343. v-bind:d-index="[nav_active,temp_index]"
  344. v-bind:m-index="dIndex"
  345. v-bind:d-type="dType"
  346. ></app-exclusive-coupon-two>
  347. </template>
  348. <template v-else-if="temp.id === 'timer'">
  349. <app-diy-timer
  350. v-bind:pic-url="temp.data.picUrl"
  351. v-bind:start-date-time="temp.data.startDateTime"
  352. v-bind:end-date-time="temp.data.endDateTime"
  353. v-bind:page-hide="pageHide"
  354. v-bind:bg-pic-url="temp.data.bgPicUrl"
  355. v-bind:link="temp.data.link"
  356. ></app-diy-timer>
  357. </template>
  358. <template v-else-if="temp.id === 'mch'">
  359. <view :style="[
  360. {'background-color':`${temp.data.backgroundColor}`,
  361. 'background-image': temp.data.backgroundPicUrl ? `url(${temp.data.backgroundPicUrl})` : `none`,
  362. 'background-size':`${temp.data.backgroundWidth + '% ' + temp.data.backgroundHeight + '%'}`,
  363. 'background-position':`${transLabelBackgroundPosition(temp.data.position)}`,
  364. 'background-repeat':`${transLabelBackgroundRepeat(temp.data.mode)}`}]"
  365. >
  366. <app-goods-shop
  367. v-bind:card-style="temp.data.cardStyle"
  368. v-bind:background-color="temp.data.backgroundColor"
  369. type="diy"
  370. v-bind:theme="theme"
  371. v-bind:mch_list="temp.data.list"
  372. v-bind:coupon_req="coupon_req"
  373. v-bind:is_required="is_required"
  374. v-bind:show-goods="temp.data.showGoods"
  375. ></app-goods-shop>
  376. </view>
  377. </template>
  378. <template v-else-if="temp.id === 'empty'">
  379. <app-empty
  380. v-bind:height="temp.data.height"
  381. v-bind:background-color="temp.data.background"
  382. ></app-empty>
  383. </template>
  384. <template v-else-if="temp.id === 'ad'">
  385. <app-ad
  386. v-bind:unit-id="temp.data.id"
  387. v-bind:type="temp.data.type"
  388. v-bind:coupon-url="coupon_url"
  389. v-bind:video-url="temp.data.video_url"
  390. v-bind:pic-url="temp.data.pic_url"
  391. v-bind:coupon-params="item | getObje"
  392. ></app-ad>
  393. </template>
  394. <template v-else-if="temp.id === 'modal'">
  395. <app-popup-ad
  396. v-bind:opened="temp.data.opened"
  397. v-bind:times="temp.data.times"
  398. v-bind:list="temp.data.list"
  399. v-bind:multiple="true"
  400. v-bind:is_storage="is_storage"
  401. v-bind:mark="homePages.id + '-' + homePages.navs[nav_active].id + '-' + temp_index"
  402. ></app-popup-ad>
  403. </template>
  404. <template v-else-if="temp.id === 'quick-nav' && temp.data.navSwitch == 1">
  405. <app-quick-navigation
  406. v-bind:value="temp.data"
  407. v-bind:use-mall-config="temp.data.useMallConfig"
  408. ></app-quick-navigation>
  409. </template>
  410. <!-- #ifdef MP-WEIXIN -->
  411. <template v-else-if="temp.id === 'mp-link'">
  412. <view v-bind:class="temp.data.position === 'top' ? `mp-link-top` : ``">
  413. <official-account
  414. v-on:load="mpLink(temp.data.position)"
  415. v-on:error="mpLinkError"
  416. ></official-account>
  417. </view>
  418. </template>
  419. <!-- #endif -->
  420. <!-- #ifndef MP-TOUTIAO -->
  421. <template v-else-if="temp.id === 'map'">
  422. <app-map
  423. v-bind:background-pic-url="temp.data.backgroundPicUrl"
  424. v-bind:height="temp.data.height"
  425. v-bind:latitude="temp.data.latitude"
  426. v-bind:longitude="temp.data.longitude"
  427. v-bind:margin-top="temp.data.marginTop"
  428. v-bind:margin-top-color="temp.data.marginTopColor"
  429. v-bind:padding-x="temp.data.paddingX"
  430. v-bind:padding-y="temp.data.paddingY"
  431. ></app-map>
  432. </template>
  433. <!-- #endif -->
  434. <template v-else-if="temp.id === 'check-in'">
  435. <app-check-in
  436. v-bind:background-pic-url="temp.data.backgroundPicUrl"
  437. v-bind:hotspot="temp.data.hotspot"
  438. v-bind:show-text="temp.data.showText"
  439. v-bind:text-color="temp.data.textColor"
  440. v-bind:text-position="temp.data.textPosition"
  441. ></app-check-in>
  442. </template>
  443. <template v-else-if="temp.id === 'image-text'">
  444. <view style="padding: 0 24rpx;">
  445. <app-rich v-bind:content='temp.data.content'></app-rich>
  446. </view>
  447. </template>
  448. <template v-else-if="temp.id === 'form'">
  449. <app-diy-form
  450. v-bind:title="temp.name"
  451. v-bind:list="temp.data.formDialog"
  452. v-bind:item-padding-x="temp.data.inputPadding"
  453. v-bind:item-margin-y="temp.data.marginBottom"
  454. v-bind:item-height="temp.data.height"
  455. v-bind:show-item-border="false"
  456. v-bind:label-position="transLabelPosition(temp.data.style)"
  457. v-bind:label-color="temp.data.inputLabel"
  458. label-text-align="left"
  459. v-bind:show-input-border="true"
  460. v-bind:input-background="temp.data.inputBackground"
  461. v-bind:input-border-color="temp.data.inputBorder"
  462. v-bind:input-text-color="temp.data.inputText"
  463. v-bind:input-placeholder-color="temp.data.inputTip"
  464. v-bind:input-radius="temp.data.radius"
  465. v-bind:show-submit="true"
  466. v-bind:submit-url="diyFormSubmitUrl"
  467. v-bind:submit-btn-text="temp.data.borderContent"
  468. v-bind:submit-btn-height="temp.data.buttonHeight"
  469. v-bind:submit-btn-padding="temp.data.buttonPadding"
  470. v-bind:submit-btn-margin="temp.data.buttonMargin"
  471. v-bind:submit-btn-radius="temp.data.buttonRadius"
  472. v-bind:submit-btn-background="temp.data.borderBackground"
  473. v-bind:submit-btn-border-color="temp.data.borderBorder"
  474. v-bind:submit-btn-text-color="temp.data.borderText"
  475. v-bind:background-color="temp.data.backgroundColor"
  476. v-bind:background-image="temp.data.backgroundPicUrl"
  477. v-bind:background-width="temp.data.backgroundWidth"
  478. v-bind:background-height="temp.data.backgroundHeight"
  479. v-bind:background-position="transLabelBackgroundPosition(temp.data.position)"
  480. v-bind:background-repeat="transLabelBackgroundRepeat(temp.data.mode)"
  481. v-bind:margin-top="temp.data.marginTop"
  482. v-bind:margin-color="temp.data.marginColor"
  483. v-bind:padding-top="temp.data.padding"
  484. v-bind:padding-bottom="temp.data.padding"
  485. v-bind:select-box-color="temp.data.selectBoxColor"
  486. ></app-diy-form>
  487. </template>
  488. <!--超级会员卡组件-->
  489. <template v-else-if="temp.id === 'vip-card'">
  490. <app-vip-card
  491. v-bind:value="temp.data" top="0"
  492. v-bind:background="temp.data.background"
  493. ></app-vip-card>
  494. </template>
  495. <!--直播组件-->
  496. <!-- #ifdef MP-WEIXIN -->
  497. <template v-else-if="temp.id === 'live'">
  498. <app-live v-bind:value="temp.data"></app-live>
  499. </template>
  500. <!-- #endif -->
  501. <template v-else-if="temp.id === 'module' && is_module">
  502. <app-module
  503. v-bind:tab-type="temp.data.tabType"
  504. v-bind:tab-color="temp.data.tabColor"
  505. v-bind:text-color="temp.data.textColor"
  506. v-bind:tab-background="temp.data.tabBackground"
  507. v-bind:list="temp.data.list"
  508. v-bind:d-index="[index, temp_index]"
  509. v-bind:theme="theme"
  510. v-bind:page-hide="pageHide"
  511. v-bind:home-pages="homePages"
  512. v-bind:is_storage="is_storage"
  513. v-bind:page_id="page_id"
  514. v-bind:is_required="is_required"
  515. v-bind:coupon_req="coupon_req"
  516. @buyProduct="buyProduct"
  517. ></app-module>
  518. </template>
  519. </block>
  520. </template>
  521. </block>
  522. </view>
  523. </view>
  524. </template>
  525. <script>
  526. import {mapState} from 'vuex';
  527. import appSearchFor from '../../page-component/app-search-for/app-search-for.vue';
  528. import appSwiper from '../../page-component/app-swiper/app-swiper.vue';
  529. import uSwiper from '../../page-component/app-swiper/swiper.vue';
  530. import uAnnouncement from '../../page-component/u-announcement/u-announcement.vue';
  531. import appNavigationIcon from '../../page-component/app-navigation-icon/app-navigation-icon.vue';
  532. import appNavigationTwoIcon from '../../page-component/app-navigation-icon/app-navigation-two-icon.vue';
  533. import appVideo from '../../page-component/app-video/app-video.vue';
  534. import appAssociatedLink from '../../page-component/app-associated-link/app-associated-link.vue';
  535. import appSpecialTopic from '../../page-component/app-special-topic/app-special-topic-normal.vue';
  536. import appSpecialTopicList from '../../page-component/app-special-topic/app-special-topic-list.vue';
  537. import appImageAd from '../../page-component/app-image-ad/app-image-ad.vue';
  538. import appHotspot from '../../basic-component/app-hotspot/app-hotspot.vue';
  539. import appShop from '../../page-component/app-shop/app-shop.vue';
  540. import appCopyright from '../../page-component/app-copyright/app-copyright.vue';
  541. import appUserCenter from '../../page-component/app-user-center-top/app-user-center-top.vue';
  542. import appMyOrder from '../../page-component/app-my-order/app-my-order.vue';
  543. import appRecommendedProductList from '../../page-component/app-recommended-product/app-recommended-product-list.vue';
  544. import appExclusiveCoupon from '../../page-component/app-exclusive-coupon/app-exclusive-coupon.vue';
  545. import appExclusiveCouponTwo from '../../page-component/app-exclusive-coupon/app-exclusive-coupon-two.vue';
  546. import appDiyTimer from '../../page-component/app-diy-timer/app-diy-timer.vue';
  547. import appGoodsShop from '../../page-component/app-good-shop-recommendation/app-good-shop-recommendation.vue';
  548. import appEmpty from '../../basic-component/app-empty/app-empty.vue';
  549. import appPopupAd from '../../page-component/app-popup-ad/app-popup-ad.vue';
  550. import appQuickNavigation from '../../page-component/app-quick-navigation/app-quick-navigation.vue';
  551. import appCheckIn from '../../page-component/app-check-in/app-check-in.vue';
  552. import appRich from '../../basic-component/app-rich/parse.vue';
  553. import appReservation from "../../page-component/app-reservation/app-reservation.vue";
  554. import appSpike from "../../page-component/app-spike/app-spike.vue";
  555. import appDiyGoodsList from "../../page-component/app-diy-goods-list/app-diy-goods-list.vue";
  556. import appDiyForm from "../../page-component/app-diy-form/app-diy-form.vue";
  557. import appVipCard from "../../page-component/app-vip-card/app-vip-card.vue";
  558. import appAd from "../../page-component/app-ad/app-ad.vue";
  559. import appModule from "../../page-component/index/app-module.vue";
  560. import uOrdinaryList from '../u-goods-list/u-ordinary-list.vue';
  561. // #ifdef MP-WEIXIN
  562. import appLive from "../../page-component/app-live/app-live.vue";
  563. // #endif
  564. // #ifndef MP-TOUTIAO
  565. import appMap from "../../page-component/app-map/app-map.vue";
  566. // #endif
  567. export default {
  568. name: "app-diy-page",
  569. components: {
  570. 'app-search-for': appSearchFor,
  571. 'app-swiper': appSwiper,
  572. uAnnouncement,
  573. 'app-navigation-icon': appNavigationIcon,
  574. 'app-navigation-two-icon': appNavigationTwoIcon,
  575. 'app-video': appVideo,
  576. 'app-associated-link': appAssociatedLink,
  577. 'app-special-topic': appSpecialTopic,
  578. 'app-special-topic-list': appSpecialTopicList,
  579. 'app-image-ad': appImageAd,
  580. 'app-hotspot': appHotspot,
  581. 'app-shop': appShop,
  582. 'app-copyright': appCopyright,
  583. 'app-user-center': appUserCenter,
  584. 'app-my-order': appMyOrder,
  585. 'app-recommended-product-list': appRecommendedProductList,
  586. 'app-exclusive-coupon': appExclusiveCoupon,
  587. appExclusiveCouponTwo,
  588. 'app-diy-timer': appDiyTimer,
  589. 'app-goods-shop': appGoodsShop,
  590. 'app-empty': appEmpty,
  591. 'app-popup-ad': appPopupAd,
  592. 'app-quick-navigation': appQuickNavigation,
  593. 'app-check-in': appCheckIn,
  594. 'app-rich': appRich,
  595. 'app-reservation': appReservation,
  596. 'app-spike': appSpike,
  597. 'app-diy-goods-list': appDiyGoodsList,
  598. 'app-diy-form': appDiyForm,
  599. 'app-vip-card': appVipCard,
  600. // 普通商品列表
  601. uOrdinaryList,
  602. // #ifndef MP-TOUTIAO
  603. appMap,
  604. // #endif
  605. appAd,
  606. appModule,
  607. // #ifdef MP-WEIXIN
  608. appLive,
  609. // #endif
  610. uSwiper
  611. },
  612. props: {
  613. dIndex: {
  614. type: Array,
  615. default() {
  616. return [0, 0];
  617. }
  618. },
  619. dType: String, //module 模块
  620. homePages: {
  621. type: Object,
  622. default() {
  623. return {
  624. navs: []
  625. };
  626. }
  627. },
  628. scrollTop: {
  629. type: Number,
  630. default() {
  631. return 0;
  632. }
  633. },
  634. is_storage: Boolean,
  635. shareFixed: Boolean,
  636. pageHide: Boolean,
  637. theme: String,
  638. coupon_req: Boolean,
  639. is_required: Boolean,
  640. page_id: Number,
  641. is_module: {
  642. type: Boolean,
  643. default() {
  644. return true;
  645. }
  646. }
  647. },
  648. computed: {
  649. newData() {
  650. if (this.homePages) {
  651. if (this.homePages.title) {
  652. uni.setNavigationBarTitle({
  653. title: this.homePages.title,
  654. });
  655. }
  656. return this.homePages;
  657. } else {
  658. return {
  659. navs: [],
  660. }
  661. }
  662. },
  663. ...mapState({
  664. userCenter: state => state.mallConfig.user_center,
  665. }),
  666. diyFormSubmitUrl() {
  667. return this.$api.diy.page_store;
  668. },
  669. themeObject:function() {
  670. return {
  671. back: this.theme + '-m-back ' + this.theme,
  672. backP: this.theme + '-m-back-p ' + this.theme,
  673. backO: this.theme + '-m-back-o ' + this.theme,
  674. theme: this.theme,
  675. color: this.theme + '-m-text ' + this.theme,
  676. sBack: this.theme + '-s-back ' + this.theme,
  677. border: this.theme + '-m-border ' + this.theme,
  678. }
  679. },
  680. },
  681. data() {
  682. return {
  683. nav_active: 0,
  684. mp_link_top: false,
  685. coupon_url: this.$api.diy.receive,
  686. coupon_params: {},
  687. goods_rank:[{
  688. name:'综合',
  689. is_rank:false,
  690. is_choose: true,
  691. },{
  692. name:'销量',
  693. is_rank:true,
  694. is_choose: false,
  695. rank_type:'default',
  696. key:'sale',
  697. default_img:'../../../static/image/icon/price-sort-default.png',
  698. top_img:'../../../static/image/icon/price-sort-to-high.png',
  699. low_img:'../../../static/image/icon/price-sort-to-low.png',
  700. },{
  701. name:'价格',
  702. is_rank:true,
  703. is_choose: false,
  704. rank_type:'default',
  705. key:'price',
  706. default_img:'../../../static/image/icon/price-sort-default.png',
  707. top_img:'../../../static/image/icon/price-sort-to-high.png',
  708. low_img:'../../../static/image/icon/price-sort-to-low.png',
  709. },/*{
  710. name:'最新上架',
  711. is_rank:true,
  712. is_choose: false,
  713. rank_type:'default',
  714. key:'time',
  715. default_img:'../../../static/image/icon/price-sort-default.png',
  716. top_img:'../../../static/image/icon/price-sort-to-high.png',
  717. low_img:'../../../static/image/icon/price-sort-to-low.png',
  718. }*/]
  719. };
  720. },
  721. filters: {
  722. getObje(data) {
  723. if (!data) return;
  724. return {
  725. template_id: data.template_id
  726. }
  727. }
  728. },
  729. methods: {
  730. changeNav(index) {
  731. this.nav_active = index;
  732. this.mp_link_top = false;
  733. },
  734. rubikHotspot(hotspot) {
  735. if (hotspot && hotspot.link) {
  736. hotspot.link.url = hotspot.link.value;
  737. hotspot.link.openType = hotspot.link.open_type;
  738. }
  739. return hotspot;
  740. },
  741. mpLink(position) {
  742. if (position === 'top') {
  743. this.mp_link_top = true;
  744. }
  745. },
  746. transLabelPosition(val) {
  747. val = Number(val);
  748. switch (val) {
  749. case 3:
  750. return 'top';
  751. case 2:
  752. return 'inset';
  753. default:
  754. return 'left';
  755. }
  756. },
  757. transLabelBackgroundPosition(val) {
  758. val = Number(val);
  759. switch (val) {
  760. case 1:
  761. return 'left top';
  762. case 2:
  763. return 'center top';
  764. case 3:
  765. return 'right top';
  766. case 4:
  767. return 'left center';
  768. case 5:
  769. return 'center center';
  770. case 6:
  771. return 'right center';
  772. case 7:
  773. return 'left bottom';
  774. case 8:
  775. return 'center bottom';
  776. case 9:
  777. return 'right bottom';
  778. default:
  779. return 'center';
  780. }
  781. },
  782. transLabelBackgroundRepeat(val) {
  783. val = Number(val);
  784. switch (val) {
  785. case 1:
  786. return 'no-repeat';
  787. case 2:
  788. return 'repeat-x';
  789. case 3:
  790. return 'repeat-y';
  791. case 4:
  792. return 'repeat';
  793. default:
  794. return 'no-repeat';
  795. }
  796. },
  797. mpLinkError() {
  798. this.mp_link_top = false;
  799. },
  800. buyProduct(data) {
  801. this.$emit('buyProduct', data);
  802. },
  803. changeRank(item,goods_list){
  804. let _this = this;
  805. _this.goods_rank.forEach(val => {
  806. if(item.key == val.key){
  807. val.is_choose = true;
  808. switch ( val.rank_type) {
  809. case 'default':
  810. case 'top':
  811. val.rank_type = 'low';
  812. break;
  813. case 'low':
  814. val.rank_type = 'top';
  815. break;
  816. }
  817. }else{
  818. val.is_choose = false;
  819. val.rank_type = 'default';
  820. }
  821. });
  822. if(!goods_list.old){
  823. goods_list.old = JSON.stringify(goods_list)
  824. }
  825. switch (item.key) {
  826. case 'sale':
  827. goods_list.sort(_this.compare('sales',item.rank_type))
  828. break;
  829. case 'price':
  830. goods_list.sort(_this.compare('price',item.rank_type))
  831. break;
  832. case 'time':
  833. goods_list.sort(_this.compare('age',item.rank_type))
  834. break;
  835. default:
  836. goods_list.sort(_this.compare('id',item.rank_type))
  837. }
  838. },
  839. compare (property,type){
  840. let regex = /\d+/;
  841. return function (obj1, obj2) {
  842. let value1 = regex.exec(obj1[property]);
  843. let value2 = regex.exec(obj2[property]);
  844. value1 = value1[0];
  845. value2 = value2[0];
  846. if(type == 'top'){
  847. return value1 - value2; // 升序
  848. }
  849. return value2 - value1; // 降序
  850. }
  851. }
  852. }
  853. }
  854. </script>
  855. <style scoped lang="scss">
  856. .app-diy-bg {
  857. position: fixed;
  858. top: 0;
  859. left: 0;
  860. width: 100%;
  861. height: 100%;
  862. z-index: -1;
  863. }
  864. //#ifdef MP-ALIPAY
  865. .app-diy-page /deep/ .app-diy-page {
  866. position: static !important;
  867. z-index: auto !important;
  868. }
  869. //#endif
  870. .app-diy-page {
  871. width: 100%;
  872. height: 100%;
  873. .nav-bar {
  874. position: fixed;
  875. left: 0;
  876. top: 0;
  877. z-index: 1500;
  878. background-color: #ffffff;
  879. width: 100%;
  880. height: #{44px};
  881. padding: 0 #{30rpx};
  882. overflow-x: auto;
  883. border-bottom: #{1rpx} solid #e2e2e2;
  884. .nav-bar-one {
  885. width: auto;
  886. margin-right: #{30rpx};
  887. padding: 0 #{15rpx};
  888. &.active {
  889. border-bottom: #{4rpx} solid;
  890. }
  891. }
  892. &.mp_link_top {
  893. top: #{84px};
  894. }
  895. &.mp_link_top ~ .diy-template {
  896. margin-top: #{44px + 84px};
  897. }
  898. & ~ .diy-template {
  899. margin-top: #{44px};
  900. }
  901. }
  902. .mp-link-top {
  903. position: fixed;
  904. top: 0;
  905. left: 0;
  906. z-index: 1500;
  907. width: 100%;
  908. }
  909. &.mp_link_top {
  910. margin-top: #{168rpx};
  911. }
  912. }
  913. .goods-rank{
  914. display: flex;
  915. align-items: center;
  916. justify-content: center;
  917. padding: 20rpx 30rpx;
  918. margin-bottom: -20rpx;
  919. .item{
  920. flex: 1;
  921. display: flex;
  922. align-items: center;
  923. justify-content: start;
  924. &.active{
  925. font-weight: 600;
  926. font-size: 32rpx;
  927. }
  928. text{
  929. font-size: 28rpx;
  930. margin-right: 10rpx;
  931. }
  932. image{
  933. width: 20rpx;
  934. height: 30rpx;
  935. }
  936. }
  937. }
  938. </style>