shopping.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <!-- 十元购 -->
  3. <view style="position: relative;">
  4. <view class="back" style="z-index: -1;">
  5. </view>
  6. <u-navbar bgColor="#FE2E2E" :safeAreaInsetTop="true" :placeholder='true'>
  7. <view class="u-nav-slot" slot="left">
  8. <image v-if="language =='zh-CN'" src="../../static/shopping/title.png"
  9. style="width: 390rpx;height: 48rpx;" mode=""></image>
  10. <image v-if="language =='en-US'" src="/static/shopping/title1.png" style="width: 390rpx;height: 48rpx;"
  11. mode="">
  12. </image>
  13. <image v-if="language =='es-ES'" src="/static/shopping/title2.png" style="width: 390rpx;height: 48rpx;"
  14. mode="">
  15. </image>
  16. <image v-if="language =='it-IT'" src="/static/shopping/title3.png" style="width: 390rpx;height: 48rpx;"
  17. mode="">
  18. </image>
  19. </view>
  20. </u-navbar>
  21. <view class="input u-flex u-row-between" style="margin-top: 16rpx;">
  22. <view class="u-flex">
  23. <image src="../../static/shopping/search.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
  24. <input v-model="keyword" type="text" :placeholder="i18n.Searchcon"
  25. style="width: 500rpx;margin-left: 14rpx;" />
  26. </view>
  27. <view class="search" @click="search">{{i18n.search}}</view>
  28. </view>
  29. <view class="content">
  30. <view class="">
  31. <!-- <u-tabs lineColor="#f56c6c" :activeStyle="{
  32. color: 'rgba(248, 53, 39, 1)',
  33. fontWeight: 'bold',
  34. transform: 'scale(1.05)'
  35. }" :list="list1" @click="click"></u-tabs> -->
  36. <u-tabs :activeStyle="{
  37. color: 'rgba(248, 53, 39, 1)',
  38. fontWeight: 'bold',
  39. transform: 'scale(1.05)'
  40. }" :list="list1" lineColor='rgba(248, 53, 39, 1)' @change='changetab'></u-tabs>
  41. </view>
  42. <view class="u-flex u-row-between" style="margin-top: 24rpx;flex-wrap: wrap;">
  43. <view @click="todetail(item.id)" class="item" v-for="(item,idx) in list" :key="idx"
  44. style="margin-bottom: 20rpx;">
  45. <image :src="item.goods.image" style="width: 340rpx;height: 340rpx;" mode=""></image>
  46. <view class="" style="padding: 20rpx;box-sizing: border-box;">
  47. <!-- <text class="title">可心柔 V9系列婴儿保wadhbiuawd</text> -->
  48. <text class="title" v-if="language =='zh-CN'">
  49. {{item.goods.name_cn}}
  50. </text>
  51. <view class="title" v-if="language =='en-US'">
  52. {{item.goods.name_en}}
  53. </view>
  54. <view class="title" v-if="language =='es-ES'">
  55. {{item.goods.name_es}}
  56. </view>
  57. <view class="title" v-if="language =='it-IT'">
  58. {{item.goods.name_ita}}
  59. </view>
  60. <view class="u-flex" style="margin-top: 12rpx;flex-wrap: wrap;column-gap: 12rpx;">
  61. <view class="tabsa" v-for="(child,idx) in item.goods.label_arr" :key="idx">
  62. <text class="titl" v-if="language =='zh-CN'">
  63. {{child.name_cn}}
  64. </text>
  65. <view class="titl" v-if="language =='en-US'">
  66. {{child.name_en}}
  67. </view>
  68. <view class="titl" v-if="language =='es-ES'">
  69. {{child.name_es}}
  70. </view>
  71. <view class="titl" v-if="language =='it-IT'">
  72. {{child.name_ita}}
  73. </view>
  74. </view>
  75. </view>
  76. <!-- <view class="num">
  77. {{i18n.Soldout}}{{item.goods.sale_num}}{{i18n.piece}}
  78. </view> -->
  79. <view class="num">
  80. {{i18n.Soldout}}{{item.goods.sale_num}}
  81. </view>
  82. <view class="" style="margin-top: 16rpx;position: relative;">
  83. <image src="/static/shopping/btn.png"
  84. style="width: 300rpx;height: 68rpx;position: absolute;top:0;left:0;" mode=""></image>
  85. <view class="u-flex u-row-between"
  86. style="padding:10rpx 20rpx 0 26rpx;width: 85%;position: relative;z-index: 1;">
  87. <view class="" style="margin-top: 10rpx;">
  88. <text class="money">¥</text>
  89. <text class="money" style="font-size: 40rpx;">{{item.goods.discount_price}}</text>
  90. </view>
  91. <image v-if="language =='zh-CN'" src="../../static/shopping/shop.png"
  92. style="width: 82rpx;height: 38rpx;" mode="">
  93. </image>
  94. <image v-if="language =='en-US'" src="/static/shopping/shop1.png"
  95. style="width: 80rpx;height: 44rpx;" mode="">
  96. </image>
  97. <image v-if="language =='es-ES'" src="/static/shopping/shop2.png"
  98. style="width: 74rpx;height: 20rpx;" mode="">
  99. </image>
  100. <image v-if="language =='it-IT'" src="/static/shopping/shop3.png"
  101. style="width: 62rpx;height: 44rpx;" mode="">
  102. </image>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="" style="height: 80rpx;"></view>
  110. <view class="" style="height: 160rpx;"></view>
  111. <kj-tabbar :value1=2></kj-tabbar>
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data() {
  117. return {
  118. list1: [],
  119. language: 'zh-CN', //语言
  120. list: [],
  121. keyword: '',
  122. parent_id: '',
  123. page: 1,
  124. last_page: ''
  125. };
  126. },
  127. computed: {
  128. i18n() {
  129. return this.$t('index')
  130. }
  131. },
  132. onShow() {
  133. if (uni.getStorageSync('language') != '') {
  134. this.language = uni.getStorageSync('language')
  135. }
  136. this.category()
  137. this.shipp()
  138. },
  139. methods: {
  140. onReachBottom() {
  141. if (this.page == this.last_page) {
  142. this.$u.toast(this.i18n.Nofurtherdata)
  143. } else {
  144. // if (this.current != 0) {
  145. this.page++
  146. this.shipp()
  147. // }
  148. }
  149. },
  150. //跳转详情
  151. todetail(id) {
  152. uni.navigateTo({
  153. url: '/pageA/productdetails?id=' + id
  154. })
  155. },
  156. //搜索
  157. search() {
  158. this.shipp(this.parent_id)
  159. },
  160. //10元购
  161. shipp() {
  162. uni.$u.http.post('/api/goods/ten_yuan_goods', {
  163. parent_id: this.parent_id,
  164. keyword: this.keyword,
  165. page: this.page
  166. }).then((res) => {
  167. console.log(res);
  168. this.last_page = res.last_page
  169. if (this.page == 1) {
  170. this.list = res.data
  171. } else {
  172. this.list = this.list.concat(res.data)
  173. }
  174. }).catch(() => {
  175. })
  176. },
  177. //商品分类列表
  178. category() {
  179. uni.$u.http.get('/api/goods/category', {
  180. params: {
  181. parent_id: 0,
  182. }
  183. }).then((res) => {
  184. const categoryArr = res
  185. this.list1 = [{
  186. name: '',
  187. category_id: ''
  188. }]
  189. if (this.language == 'en-US') {
  190. categoryArr.forEach(item => {
  191. item.name = item.name_en
  192. })
  193. this.list1[0].name = 'selection'
  194. }
  195. if (this.language == 'es-ES') {
  196. categoryArr.forEach(item => {
  197. item.name = item.name_es
  198. })
  199. this.list1[0].name = 'Una selección de'
  200. }
  201. if (this.language == 'it-IT') {
  202. categoryArr.forEach(item => {
  203. item.name = item.name_ita
  204. })
  205. this.list1[0].name = 'selezionate'
  206. }
  207. if (this.language == 'zh-CN') {
  208. categoryArr.forEach(item => {
  209. item.name = item.name_cn
  210. })
  211. this.list1[0].name = '精选'
  212. }
  213. this.list1 = this.list1.concat(categoryArr)
  214. console.log(this.list1);
  215. }).catch(() => {
  216. })
  217. },
  218. changetab(item) {
  219. this.list = []
  220. this.page = 1
  221. this.parent_id = item.id
  222. console.log('item', item);
  223. this.shipp(item.id)
  224. }
  225. },
  226. computed: {
  227. i18n() {
  228. return this.$t('index')
  229. }
  230. },
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .content {
  235. width: 750rpx;
  236. min-height: calc(100vh - 40rpx);
  237. background: linear-gradient(180deg, #FDFCFB 0%, #F4F4F4 100%);
  238. border-radius: 30rpx 30rpx 0rpx 0rpx;
  239. margin-top: 32rpx;
  240. padding: 32rpx;
  241. box-sizing: border-box;
  242. .item {
  243. width: 340rpx;
  244. // height: 592rpx;
  245. background: #FFFFFF;
  246. border-radius: 16rpx;
  247. .title {
  248. font-family: PingFangSC, PingFang SC;
  249. font-weight: 400;
  250. font-size: 26rpx;
  251. color: #222222;
  252. line-height: 36rpx;
  253. text-align: left;
  254. font-style: normal;
  255. display: block;
  256. width: 100%;
  257. height: 70rpx;
  258. overflow: hidden;
  259. text-overflow: ellipsis;
  260. -webkit-line-clamp: 2;
  261. display: -webkit-box;
  262. -webkit-box-orient: vertical;
  263. word-break: break-all;
  264. }
  265. .tabsa {
  266. // width: 96rpx;
  267. // height: 32rpx;
  268. margin-top: 10rpx;
  269. border-radius: 4rpx;
  270. border: 1rpx solid #ED0909;
  271. font-family: PingFangSC, PingFang SC;
  272. font-weight: 400;
  273. font-size: 20rpx;
  274. color: #ED0909;
  275. // line-height: 32rpx;
  276. text-align: center;
  277. font-style: normal;
  278. display: inline;
  279. padding: 0 4rpx;
  280. box-sizing: border-box;
  281. }
  282. .num {
  283. font-family: SFPro, SFPro;
  284. font-weight: 400;
  285. font-size: 20rpx;
  286. color: #555555;
  287. line-height: 24rpx;
  288. text-align: left;
  289. font-style: normal;
  290. margin-top: 16rpx;
  291. }
  292. .money {
  293. font-family: HarmonyOS_Sans_Medium;
  294. font-size: 20rpx;
  295. color: #F83224;
  296. line-height: 26rpx;
  297. text-align: left;
  298. font-style: normal;
  299. }
  300. }
  301. }
  302. .back {
  303. position: absolute;
  304. top: 0;
  305. left: 0;
  306. width: 750rpx;
  307. height: 800rpx;
  308. background: #FE2E2E;
  309. }
  310. .input {
  311. width: 702rpx;
  312. height: 68rpx;
  313. background: #FFFFFF;
  314. border-radius: 34rpx;
  315. margin-left: 24rpx;
  316. box-sizing: border-box;
  317. padding: 0 8rpx 0 24rpx;
  318. .search {
  319. width: 100rpx;
  320. height: 56rpx;
  321. background: #F83224;
  322. border-radius: 28rpx;
  323. font-family: PingFangSC, PingFang SC;
  324. font-weight: 400;
  325. font-size: 26rpx;
  326. color: #FFFFFF;
  327. line-height: 56rpx;
  328. text-align: center;
  329. font-style: normal;
  330. }
  331. }
  332. </style>