123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- <template>
- <view class="box">
- <view class="topbox">
- <view class="sstop">
- <image src="../../static/timg/icon_search@2x.png" mode="" class="sstopimg"></image>
- <input type="text" v-model="name" placeholder="请输入商品名称" class="sstopInput" @confirm="ssList">
- <image src="../../static/img/icon_close.png" mode="" @click="empty" v-if="inputChShow" class="inputCh"></image>
- </view>
- <scroll-view scroll-x="true" class="scroll-Y" >
- <view class="classificationBox">
- <view class="classification" v-for="(item,index) in categoryList" @click="topClick(index,item)">
- <view class="classificationName" :class="{classificationNameActive:topIndex==index}">{{item.name}}</view>
- <view class="classificationHx" v-if="topIndex==index"></view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view style="height: 180rpx;"></view>
- <view class="paixuBox">
- <view class="paixuLine" @click="defaultpx" :class="{pxActive:defaultpxActive}">
- 默认排序
- </view>
- <view class="paixuLine" @click="xlPx(1)">
- <view :class="{pxActive:salessort}">销量</view>
- <view class="paixuLineTbBox">
- <view class="paixuLineTbtop" >
- <image v-if="salessorts" src="../../static/timg/icon_arrow_up_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
- <image v-else src="../../static/timg/icon_arrow_up_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
- </view>
- <view class="paixuLineTbtop">
- <image v-if="salessortx" src="../../static/timg/icon_arrow_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
- <image v-else src="../../static/timg/icon_arrow_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
- </view>
- </view>
- </view>
- <view class="paixuLine" @click="jgpx(1)">
- <view :class="{pxActive:pricesort}">价格</view>
- <view class="paixuLineTbBox">
- <view class="paixuLineTbtop" >
- <image v-if="pricesorts" src="../../static/timg/icon_arrow_up_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
- <image v-else src="../../static/timg/icon_arrow_up_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIcons"></image>
- </view>
- <view class="paixuLineTbtop">
- <image v-if="pricesortx" src="../../static/timg/icon_arrow_pre@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
- <image v-else src="../../static/timg/icon_arrow_def@2x.png" mode="" class="paixuLineTbtopIcon paixuLineTbtopIconx"></image>
- </view>
- </view>
- </view>
- </view>
- <scroll-view scroll-Y="true" class="scroll-Y goodsSw" >
- <view class="goodsBox">
- <view class="hotGoodsLine" v-for="(item,index) in list" @click="goDetail(item)">
- <view>
- <image :src="item.url" v-if="item.url" mode="" @error="defImg()" class="hotGoodsLineImg"></image>
- <image v-else src="../../static/timg/noimg.png" mode="" class="hotGoodsLineImg"></image>
- </view>
- <view class="hotGoodsLineRIght">
- <view class="goodsName">{{item.name}}</view>
- <view class="Sold" >
- <view v-if="item.showLabel&&item.showLabel.indexOf('3')!=-1">
- 已售 {{item.saleQty}}
- </view>
- </view>
- <view class="goodsPrice">
- <view class="goodsPrice1">{{item.saleLabel}}</view>
- <view class="goodsPrice2">¥</view>
- <view class="goodsPrice3">{{item.salePrice?item.salePrice:item.scribingPrice}}</view>
- <view class="goodsPrice4" v-if="item.showLabel&&item.scribingPrice">
- <span v-if="item.showLabel.indexOf('1')!=-1">¥{{item.scribingPrice}}</span>
- </view>
- </view>
- </view>
- </view>
- <nodata v-if="list.length==0"></nodata>
- </view>
- </scroll-view>
-
-
- <!-- 手机号授权 -->
- <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
- <view class="authorizCont" @click.stop="">
- <view class="authorizName">{{wxOpenData.miniAppName}}</view>
- <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
- <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
- </view>
- <view style="text-align: center;padding-top: 56rpx;">
- <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
- </view>
- </view>
-
-
- </view>
- </template>
- <script>
- import nodata from '../../components/nodata/nodata.vue'
- export default {
- components: {
- nodata
- },
-
- data() {
- return {
- userInfo:'',
- salessort:false,
- salessorts:false,
- salessortx:false,
- pricesort:false,
- pricesorts:false,
- pricesortx:false,
- topIndex:0,
- categoryList:'',
- page:1,
- limit:10,
- name:'',
- categoryID:'',
- order:'',
- orderBy:'',
- list:[],
- defaultImg: require("../../static/timg/noimg.png"),
- defaultpxActive:false,
- authorizShow:false,
- code:'',
- wxOpenData:'',
- shopcategoryID:'',
- inputChShow:false,
- ext:'',
- }
- },
- watch:{
- name(val){
- console.log(val)
- if(val){
- this.inputChShow=true
- }
- },
-
- },
- onLoad(opt) {
- console.log(getApp().globalData.shopcategoryID)
- //this.userInfo = uni.getStorageSync("userInfo");
- this.shopcategoryID=getApp().globalData.shopcategoryID;
- if(this.shopcategoryID){
- this.categoryID=this.shopcategoryID
- }
- this.userInfo=this.$store.state.userInfo;
- this.wxOpenData=this.$store.state.wxOpenData;
- this.ext=this.$common.getExtStoreId();
- this.getcategoryList();
- this.getlistOpenGoodsPage();
- /* uni.getLocation({
- type: 'gcj02',
- success: function(res) {
- console.log(res)
-
- },
- fail(err) {
- console.log(err)
- }
- }); */
-
- },
- onShow() {
- var shopcategoryID = uni.getStorageSync("shopcategoryID")
- if(shopcategoryID){
- uni.removeStorageSync('shopcategoryID');
- if(this.categoryList){
- this.categoryList.forEach((item,index)=>{
- //console.log(item.id)
- if(item.id==shopcategoryID){
- this.topIndex=index
- }
- })
- this.categoryID=shopcategoryID;
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- }
- }
- },
- methods: {
- empty(){
- console.log("情况")
- this.name='';
- this.inputChShow=false;
- },
- decryptPhoneNumber: function(e) {
- console.log(e);
- this.code=e.detail.code
- this.wxPhoneLogin()
- this.authorizShow=false;
- },
- wxPhoneLogin(){
- var that=this;
- this.$http('miniApp2/sys/wxPhoneLogin', {
- appId:'wx33053a645546ec31',
- unionId:'EEADACCD-8A19-499D-8AD7-6975D2C93243',
- code:this.code,
- openId:this.wxOpenData.openid
- },'POST').then(res => {
- var data = res.data;
- if(data.loginInfo){
- this.userInfo=data.loginInfo.openUser;
- this.wxOpenData=data.loginInfo;
- this.$store.commit('mutationswxOpenData', data.loginInfo)
- this.$store.commit('mutationsuserInfo', this.userInfo)
- this.topIndex=1;
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- }
- })
- },
- xlPx(num){
- this.salessort=true;
- this.defaultpxActive=false;
- this.pricesort=false;
- this.pricesort=false;
- this.pricesorts=false;
- this.pricesortx=false;
- if(this.salessorts){
- num=2
- }
- if(num==1){
- this.salessorts=true;
- this.salessortx=false;
- this.orderBy='asc';
- }else{
- this.salessorts=false;
- this.salessortx=true;
- this.orderBy='desc';
- }
- this.order='SaleQty';
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- },
- jgpx(type){
- this.salessort=false;
- this.defaultpxActive=false;
- this.pricesort=true;
- this.salessort=false;
- this.salessorts=false;
- this.salessortx=false;
- if(this.pricesorts){
- type=2
- }
- if(type==1){
- this.pricesorts=true;
- this.pricesortx=false;
- this.orderBy='asc';
- }else{
- this.pricesorts=false;
- this.pricesortx=true;
- this.orderBy='desc';
- }
- this.order='SalePrice';
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- },
- defaultpx(){
- this.defaultpxActive=true;
- this.order='';
- this.orderBy='';
- this.salessort=false;
- this.salessorts=false;
- this.salessortx=false;
- this.pricesort=false;
- this.pricesorts=false;
- this.pricesortx=false;
- //this.topIndex=0;
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- },
- defImg(event){
- // console.log(event)
- /* let img = event.srcElement;
- img.src = this.defaultImg;
- img.onerror = null; //防止闪图 */
- },
- topClick(index,item){
- this.topIndex=index;
- this.list=[];
- this.page=1;
- this.categoryID=item.id;
- this.getlistOpenGoodsPage()
- },
- ssList(){
- this.topIndex=1;
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage()
- },
- goDetail(item){
- // if(!this.userInfo){
- // this.authorizShow=true;
- // }else{
-
- // }
- uni.navigateTo({
- url:'goodsDetail?id='+item.id
- })
-
- },
- getcategoryList(){
- this.$http('openMall/categoryList', {
- unionId:this.ext.unionId
- },'GET').then(res => {
- this.categoryList=res.data;
- var obj={
- id:'',
- name:'全部'
- }
- this.categoryList.unshift(obj);
- if(this.shopcategoryID){
- //console.log(this.shopcategoryID)
- this.categoryList.forEach((item,index)=>{
- //console.log(item.id)
- if(item.id==this.shopcategoryID){
- this.topIndex=index
- }
- })
- }
- })
- },
-
- getlistOpenGoodsPage(){
- uni.showLoading({ title: '加载中'});
- this.$http('openMall/listOpenGoodsPage', {
- page:this.page,
- limit:this.limit,
- name:this.name,
- categoryID:this.categoryID,
- orderBy:this.order,
- order:this.orderBy,
- unionId:this.ext.unionId
- },'GET').then(res => {
- uni.hideLoading();
- var data=res.data.Items;
- this.list=this.list.concat(data)
- })
- }
-
- },
- onReachBottom(){
- this.page++;
- this.getlistOpenGoodsPage()
- //console.log("shanglas")
- },
- onPullDownRefresh(){
- this.list=[];
- this.page=1;
- this.getlistOpenGoodsPage();
- setTimeout(() => {
- uni.stopPullDownRefresh(); // 关闭下拉刷新
- }, 2000);
- }
- }
- </script>
- <style scoped lang="less">
- .topbox{
- position: fixed;
- width: 750rpx;
- top: -1rpx;
- left: 0;
- z-index: 11;
- }
- .inputCh{
- width:40rpx;
- height: 40rpx;
- position: absolute;
- right: 40rpx;
- top: 40rpx;
- z-index: 11;
- }
- .pxActive{
- color: #FF0000 !important;
- }
- .paixuLineTbtopIcon{
- width: 16rpx;
- height: 8rpx;
- display: block;
- padding-left: 10rpx;
- }
- .paixuLineTbtopIconx{
- padding-bottom:24rpx;
- }
- .paixuLineTbtopIcons{
- padding-top: 8rpx;
- }
- .paixuLineTbBox{
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .box{
- background: #F4F5F7;
- min-height: 100vh;
- }
- .sstopInput{
- width: 626rpx;
- height: 72rpx;
- background: #F4F5F7;
- border-radius: 36rpx;
- line-height: 72rpx;
- font-size: 28rpx;
- padding-left: 76rpx;
- }
- .sstop{
- position: relative;
- padding-top: 24rpx;
- padding-left: 24rpx;
- background: #ffffff;
- }
- .sstopimg{
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- left: 44rpx;
- top: 40rpx;
- }
- .scroll-Y{
- background: #ffffff;
- width: 750rpx;
-
- }
- .goodsBox{
- min-height: calc(100vh - 280rpx);
- }
- .classificationBox{
- display: flex;
- padding-bottom: 12rpx;
- }
- .classificationName{
- white-space: nowrap;
- font-size: 28rpx;
- color: #3C3C3C;
- line-height: 40rpx;
- padding:24rpx 24rpx 8rpx 24rpx;
- font-weight: 400;
- }
- .classificationNameActive{
- font-weight: 500 !important;
- color: #FF0000 ;
- }
- .classificationHx{
- width: 40rpx;
- height: 4rpx;
- background: #FF0000;
- margin: 0 auto;
- }
- .paixuBox{
- width: 750rpx;
- height: 72rpx;
- background: #FFFFFF;
- margin-top: 20rpx;
- display: flex;
- justify-content: space-around;
- border-bottom: 1px solid #EEEEEE;
- }
- .paixuLine{
- line-height: 37rpx;font-size: 26rpx;color: #666666;padding-top: 18rpx;
- display: flex;
- }
- .hotGoodsLine{
- margin-top: 30rpx;
- padding:0rpx 20rpx;
- background: #FFFFFF;
- border-radius: 16rpx;
- display: flex;
- }
- .hotGoodsLineImg{
- width: 208rpx;
- height: 194rpx;
- border-radius: 16rpx;
- border: 1px solid #EEEEEE;
- display: block;
- }
- .goodsName{
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 40rpx;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .hotGoodsLineRIght{
- padding-left: 24rpx;
- }
- .goodsPrice{
- display: flex;
- padding-top: 10rpx;
- }
- .goodsPrice1{
- font-size: 24rpx;
- font-weight: 400;
- color: #FF0000;
- padding-top: 8rpx;
- }
- .goodsPrice2{
- font-size: 22rpx;
- font-weight: 400;
- color: #FF0000;
- padding-top: 10rpx;
- }
- .goodsPrice3{
- font-size: 32rpx;
- font-weight: 500;
- color: #FF0000;
- }
- .goodsPrice4{
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- padding-top: 8rpx;
- text-decoration:line-through;
- padding-left: 10rpx;
- }
- .Sold{
- font-weight: 400;
- color: #999999;
- font-size: 24rpx;
- padding-top: 8rpx;
- line-height: 30rpx;
- height: 30rpx;
- }
- .authorizBox{
- width: 100vw;
- height: 100vh;
- background: rgba(0, 0, 0, 0.5);
- position: fixed;
- top: 0;
- left: 0;
- }
- .authorizCont{
- margin-top: 30vh;
- width: 564rpx;
- height: 408rpx;
- background: #FFFFFF;
- border-radius: 24rpx;
- margin-left: 93rpx;
- position: relative;
- }
- .authorizCloseImg{
- width: 62rpx;
- height: 62rpx;
- }
- .sqLogoBox{
- width: 180rpx;
- height: 180rpx;
- background: #FFFFFF;
- border-radius: 90rpx;
- text-align: center;
- position: absolute;
- top: -50rpx;
- left: 192rpx;
- }
- .authorizName{
- color: #333333;
- line-height: 42rpx;
- font-size: 30rpx;
- text-align: center;
- padding-top: 58rpx;
- }
- .authorizMs{
- color: #999999;
- line-height: 36rpx;
- font-size: 26rpx;
- width: 452rpx;
- padding-top: 24rpx;
- text-align: center;
- margin-left: 56rpx;
- }
- .authorizContbutton{
- width: 422rpx;
- height: 88rpx;
- background: #D53533;
- border-radius: 44rpx;
- line-height: 88rpx;
- text-align: center;
- font-size:30rpx;
- color: #FFFFFF;
- margin-top: 62rpx;
- margin-left:71rpx;
- }
- </style>
|