shop.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view class="box">
  3. <view class="topbox">
  4. <view class="sstop">
  5. <image src="../../static/timg/icon_search@2x.png" mode="" class="sstopimg"></image>
  6. <input type="text" v-model="name" placeholder="请输入商品名称" class="sstopInput" @confirm="ssList">
  7. </view>
  8. <scroll-view scroll-x="true" class="scroll-Y" >
  9. <view class="classificationBox">
  10. <view class="classification" v-for="(item,index) in categoryList" @click="topClick(index,item)">
  11. <view class="classificationName">{{item.name}}</view>
  12. <view class="classificationHx" v-if="topIndex==index"></view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. <view class="paixuBox">
  17. <view class="paixuLine" @click="defaultpx" :class="{pxActive:defaultpxActive}">
  18. 默认排序
  19. </view>
  20. <view class="paixuLine">
  21. <view :class="{pxActive:salessort}">销量</view>
  22. <view class="paixuLineTbBox">
  23. <view class="paixuLineTbtop" @click="xlPx(1)">
  24. <image v-if="salessorts" src="../../static/timg/icon_arrow_up_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
  25. <image v-else src="../../static/timg/icon_arrow_up_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
  26. </view>
  27. <view class="paixuLineTbtop" @click="xlPx(2)">
  28. <image v-if="salessortx" src="../../static/timg/icon_arrow_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
  29. <image v-else src="../../static/timg/icon_arrow_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="paixuLine">
  34. <view :class="{pxActive:pricesort}">价格</view>
  35. <view class="paixuLineTbBox">
  36. <view class="paixuLineTbtop" @click="jgpx(1)">
  37. <image v-if="pricesorts" src="../../static/timg/icon_arrow_up_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
  38. <image v-else src="../../static/timg/icon_arrow_up_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
  39. </view>
  40. <view class="paixuLineTbtop" @click="jgpx(2)">
  41. <image v-if="pricesortx" src="../../static/timg/icon_arrow_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
  42. <image v-else src="../../static/timg/icon_arrow_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <scroll-view scroll-Y="true" class="scroll-Y goodsSw" >
  48. <view class="goodsBox">
  49. <view class="hotGoodsLine" v-for="(item,index) in list" @click="goDetail(item)">
  50. <view>
  51. <image :src="item.url" mode="" @error="defImg()" class="hotGoodsLineImg"></image>
  52. </view>
  53. <view class="hotGoodsLineRIght">
  54. <view class="goodsName">{{item.name}}</view>
  55. <view class="Sold">已售 {{item.saleQty}}</view>
  56. <view class="goodsPrice">
  57. <view class="goodsPrice1">店庆价</view>
  58. <view class="goodsPrice2">¥</view>
  59. <view class="goodsPrice3">{{item.scribingPrice?item.scribingPrice:item.salePrice}}</view>
  60. <view class="goodsPrice4" v-if="item.scribingPrice">¥{{item.salePrice}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. components: {
  72. },
  73. data() {
  74. return {
  75. userInfo:'',
  76. salessort:false,
  77. salessorts:false,
  78. salessortx:false,
  79. pricesort:false,
  80. pricesorts:false,
  81. pricesortx:false,
  82. topIndex:0,
  83. categoryList:'',
  84. page:1,
  85. limit:10,
  86. name:'',
  87. categoryID:'',
  88. order:'',
  89. orderBy:'',
  90. list:[],
  91. defaultImg: require("../../static/timg/noimg.png"),
  92. defaultpxActive:true,
  93. }
  94. },
  95. onLoad() {
  96. this.userInfo = uni.getStorageSync("userInfo");
  97. //this.getOrderTimes()
  98. this.getcategoryList();
  99. this.getlistOpenGoodsPage()
  100. },
  101. methods: {
  102. xlPx(num){
  103. this.salessort=true;
  104. this.defaultpxActive=false;
  105. this.pricesort=false;
  106. this.pricesort=false;
  107. this.pricesorts=false;
  108. this.pricesortx=false;
  109. if(num==1){
  110. this.salessorts=true;
  111. this.salessortx=false;
  112. this.orderBy='asc';
  113. }else{
  114. this.salessorts=false;
  115. this.salessortx=true;
  116. this.orderBy='desc';
  117. }
  118. this.order='SaleQty';
  119. //this.topIndex=0;
  120. this.list=[];
  121. this.page=1;
  122. this.getlistOpenGoodsPage()
  123. },
  124. jgpx(type){
  125. this.salessort=false;
  126. this.defaultpxActive=false;
  127. this.pricesort=true;
  128. this.salessort=false;
  129. this.salessorts=false;
  130. this.salessortx=false;
  131. if(type==1){
  132. this.pricesorts=true;
  133. this.pricesortx=false;
  134. this.orderBy='asc';
  135. }else{
  136. this.pricesorts=false;
  137. this.pricesortx=true;
  138. this.orderBy='desc';
  139. }
  140. this.order='SalePrice';
  141. this.list=[];
  142. this.page=1;
  143. this.getlistOpenGoodsPage()
  144. },
  145. defaultpx(){
  146. this.order='';
  147. this.orderBy='';
  148. this.salessort=false;
  149. this.salessorts=false;
  150. this.salessortx=false;
  151. this.pricesort=false;
  152. this.pricesorts=false;
  153. this.pricesortx=false;
  154. //this.topIndex=0;
  155. this.list=[];
  156. this.page=1;
  157. this.getlistOpenGoodsPage()
  158. },
  159. defImg(event){
  160. // console.log(event)
  161. /* let img = event.srcElement;
  162. img.src = this.defaultImg;
  163. img.onerror = null; //防止闪图 */
  164. },
  165. topClick(index,item){
  166. this.topIndex=index;
  167. this.list=[];
  168. this.page=1;
  169. this.categoryID=item.id;
  170. this.getlistOpenGoodsPage()
  171. },
  172. ssList(){
  173. this.topIndex=1;
  174. this.list=[];
  175. this.page=1;
  176. this.getlistOpenGoodsPage()
  177. },
  178. goDetail(item){
  179. uni.navigateTo({
  180. url:'goodsDetail?id='+item.id
  181. })
  182. },
  183. getcategoryList(){
  184. this.$http('openMall/categoryList', {
  185. },'GET').then(res => {
  186. this.categoryList=res.data;
  187. var obj={
  188. id:'',
  189. name:'全部'
  190. }
  191. this.categoryList.unshift(obj)
  192. })
  193. },
  194. getlistOpenGoodsPage(){
  195. uni.showLoading({ title: '加载中'});
  196. this.$http('openMall/listOpenGoodsPage', {
  197. page:this.page,
  198. limit:this.limit,
  199. name:this.name,
  200. categoryID:this.categoryID,
  201. order:this.order,
  202. orderBy:this.orderBy,
  203. },'GET').then(res => {
  204. uni.hideLoading();
  205. var data=res.data.Items;
  206. this.list=this.list.concat(data)
  207. })
  208. }
  209. },
  210. onReachBottom(){
  211. this.page++;
  212. this.getlistOpenGoodsPage()
  213. //console.log("shanglas")
  214. }
  215. }
  216. </script>
  217. <style scoped lang="less">
  218. .pxActive{
  219. color: #F03B3B !important;
  220. }
  221. .paixuLineTbtopIcon{
  222. width: 16rpx;
  223. height: 8rpx;
  224. display: block;
  225. padding-left: 10rpx;
  226. }
  227. .paixuLineTbtopIconx{
  228. padding-bottom:20rpx;
  229. }
  230. .paixuLineTbtopIcons{
  231. padding-top: 6rpx;
  232. }
  233. .paixuLineTbBox{
  234. display: flex;
  235. flex-direction: column;
  236. justify-content: space-between;
  237. }
  238. .box{
  239. background: #F4F5F7;
  240. min-height: 100vh;
  241. }
  242. .sstopInput{
  243. width: 626rpx;
  244. height: 72rpx;
  245. background: #F4F5F7;
  246. border-radius: 36rpx;
  247. line-height: 72rpx;
  248. font-size: 28rpx;
  249. padding-left: 76rpx;
  250. }
  251. .sstop{
  252. position: relative;
  253. padding-top: 24rpx;
  254. padding-left: 24rpx;
  255. background: #ffffff;
  256. }
  257. .sstopimg{
  258. width: 40rpx;
  259. height: 40rpx;
  260. position: absolute;
  261. left: 44rpx;
  262. top: 40rpx;
  263. }
  264. .scroll-Y{
  265. background: #ffffff;
  266. width: 750rpx;
  267. }
  268. .classificationBox{
  269. display: flex;
  270. padding-bottom: 12rpx;
  271. }
  272. .classificationName{
  273. white-space: nowrap;
  274. font-size: 28rpx;
  275. color: #3C3C3C;
  276. line-height: 40rpx;
  277. padding:24rpx 24rpx 8rpx 24rpx;
  278. }
  279. .classificationHx{
  280. width: 40rpx;
  281. height: 4rpx;
  282. background: #F03B3B;
  283. margin: 0 auto;
  284. }
  285. .paixuBox{
  286. width: 750rpx;
  287. height: 72rpx;
  288. background: #FFFFFF;
  289. margin-top: 20rpx;
  290. display: flex;
  291. justify-content: space-around;
  292. }
  293. .paixuLine{
  294. line-height: 37rpx;font-size: 26rpx;color: #666666;padding-top: 18rpx;
  295. display: flex;
  296. }
  297. .hotGoodsLine{
  298. margin-top: 20rpx;
  299. padding: 20rpx;
  300. background: #FFFFFF;
  301. border-radius: 16rpx;
  302. display: flex;
  303. }
  304. .hotGoodsLineImg{
  305. width: 208rpx;
  306. height: 194rpx;
  307. border-radius: 16rpx;
  308. border: 1px solid #EEEEEE;
  309. }
  310. .goodsName{
  311. font-size: 28rpx;
  312. font-family: PingFangSC-Regular, PingFang SC;
  313. font-weight: 400;
  314. color: #333333;
  315. line-height: 40rpx;
  316. text-overflow: -o-ellipsis-lastline;
  317. overflow: hidden;
  318. text-overflow: ellipsis;
  319. display: -webkit-box;
  320. -webkit-line-clamp: 2;
  321. line-clamp: 2;
  322. -webkit-box-orient: vertical;
  323. }
  324. .hotGoodsLineRIght{
  325. padding-left: 24rpx;
  326. }
  327. .goodsPrice{
  328. display: flex;
  329. padding-top: 10rpx;
  330. }
  331. .goodsPrice1{
  332. font-size: 24rpx;
  333. font-weight: 400;
  334. color: #F03B3B;
  335. padding-top: 8rpx;
  336. }
  337. .goodsPrice2{
  338. font-size: 22rpx;
  339. font-weight: 400;
  340. color: #F03B3B;
  341. padding-top: 8rpx;
  342. }
  343. .goodsPrice3{
  344. font-size: 32rpx;
  345. font-weight: 400;
  346. color: #F03B3B;
  347. }
  348. .goodsPrice4{
  349. font-size: 24rpx;
  350. font-weight: 400;
  351. color: #999999;
  352. padding-top: 8rpx;
  353. }
  354. .Sold{
  355. font-weight: 400;
  356. color: #999999;
  357. font-size: 24rpx;
  358. padding-top: 8rpx;
  359. }
  360. </style>