123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131 |
- <template>
- <div class="page shop-cart-page" :class="{ page_red: theme === 1 }">
- <div class="page__top">
- <div class="search">
- <i class="iconfont icontubiao- search__icon"></i>
- <input
- class="search__text"
- v-model="searchVal"
- @confirm="search()"
- type="text"
- placeholder="搜索你想要的商品"
- />
- <i
- class="iconfont iconclose_icon search__icon remove-icon"
- @click="closeSearchVal"
- ></i>
- </div>
- </div>
- <div class="page__content">
- <div class="page__box">
- <scroll-view class="category" :scroll-y="true">
- <ul class="category__list">
- <li
- class="category__item"
- :class="{
- 'category__item--active':
- cateId === item.categoryId,
- }"
- v-for="(item, index) in classifyList"
- :key="index"
- @click="setCategory(item)"
- >
- {{ item.name }}
- </li>
- </ul>
- </scroll-view>
- <div class="page__right">
- <div class="status-tab">
- <span
- :class="{ on: display === 1 }"
- @click="steDisplay(1)"
- >展示中</span
- >
- <span
- :class="{ on: display === 0 }"
- @click="steDisplay(0)"
- >已隐藏</span
- >
- </div>
- <div class="goods">
- <scroll-view
- class="goods__scroll"
- :scroll-y="true"
- @scrolltolower="getMoreActivityList"
- >
- <ul class="goods__list">
- <li
- class="goods__item"
- v-for="(item, index) in activityList"
- :key="index"
- >
- <div class="main" @click="goDetail(item)">
- <my-image
- class="goods__img"
- :src="item.brandLogo"
- @click="edit(item)"
- ></my-image>
- <div class="goods__info">
- <div class="goods__box">
- <div
- class="goods__title"
- @click="edit(item)"
- >
- {{ item.brandName }}
- </div>
- <div class="goods__sale black">
- {{
- item.endTime | viewDate
- }}
- </div>
- <div class="goods__sale flex">
- <span>
- {{
- item.onlineProductCount
- }}款
- </span>
- <span>
- 最多赚:{{
- item.maxCommission /
- 100
- }}
- </span>
- </div>
- </div>
- <!-- <div
- class="goods__price"
- @click="edit(item)"
- >
- <div class="goods__present">
- 价格:{{ "¥" + item.price / 100 }}
- </div>
- <div
- class="goods__original"
- v-if="item.stock !== 0"
- >
- 库存:{{ "¥" + item.stock }}
- </div>
- </div> -->
- <!-- 登录 -->
- </div>
- </div>
- <div class="btns">
- <div
- class="btn"
- @click="setActivityTop(item)"
- >
- {{
- item.top === 0
- ? "置顶"
- : "取消置顶"
- }}
- </div>
- <div
- class="btn"
- @click="setActivityDisplay(item)"
- >
- {{
- item.display === 1
- ? "隐藏"
- : "显示"
- }}
- </div>
- <div
- class="btn"
- @click="pushGive(item)"
- >
- 推送
- </div>
- <div
- class="btn"
- @click="shareApp(item)"
- >
- 分享
- </div>
- </div>
- </li>
- </ul>
- <div
- class="more-text"
- v-if="activityList.length && !isMoreEnd"
- >
- - 没有更多品牌了 -
- </div>
- <div
- class="null"
- v-if="loading && !activityList.length"
- >
- <img
- class="null__img"
- src="/static/common/goods_null.jpg"
- alt
- />
- <div class="null__title">
- 抱歉!没有找到相关品牌~
- </div>
- </div>
- </scroll-view>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import MyImage from "../../components/image/index";
- import plugin from "../../common/js/plugin";
- export default {
- name: "",
- components: { MyImage },
-
- data() {
- return {
- cateId: "",
- shopId: "",
- display: 1,
- searchVal: "",
- classifyList: [],
- activityPageIndex: 1,
- activityList: [],
- isMoreEnd: false,
- otherUrl: "https://bot.ixiaokejia.com/",
- };
- },
- filters: {
- viewDate(dateStr) {
- if (!dateStr) {
- return "";
- }
- if (isNaN(Date.parse(dateStr))) {
- return dateStr;
- }
- dateStr = dateStr.replace(/-/g, "/");
- let dateNow = Date.parse(dateStr);
- let mius = dateNow - Date.now();
- let minute = 1000 * 60;
- let hour = minute * 60;
- let day = hour * 24;
- let month = day * 30;
- let quarter = month * 3;
- let year = quarter * 12;
- if (mius < 0) {
- return `结束时间:${plugin.dateFormat(dateStr, "MM-dd hh:mm")}`;
- } else if (mius < minute) {
- return `距结束还有${Math.floor(mius / 1000)}秒`;
- } else if (mius < hour) {
- return `距结束还有${Math.floor(mius / minute)}分钟`;
- } else if (mius < day) {
- return `距结束还有${Math.floor(mius / hour)}小时`;
- } else if (mius < month) {
- return `距结束还有${Math.floor(mius / day)}天`;
- } else if (mius < quarter) {
- return `结束时间:${plugin.dateFormat(dateStr, "MM-dd hh:mm")}`;
- }
- },
- },
- onLoad(opts) {
- this.cateId = opts.cateId;
- },
- async onShow() {
- this.getClassify();
- this.getActivityList();
- },
- onPullDownRefresh() {
- this.getClassify();
- this.getActivityList();
- },
- // 函数
- methods: {
- // 获取店铺信息
- getShopInfo() {
- this.api
- .get("/Shop/GetInfo", {}, { pass: true })
- .then((infoRes) => {
- this.shopId = infoRes.data.id;
- });
- },
-
- steDisplay(val) {
- this.display = val;
- this.getActivityList();
- },
-
- getClassify() {
- this.api.get("/Yx/GetCategoryList", {}).then((res) => {
- this.classifyList = res.data;
- });
- },
-
- setCategory(val) {
- this.cateId = val.categoryId;
- this.activityPageIndex = 1;
- this.getActivityList();
- },
-
- getActivityList() {
- this.isMoreEnd = false;
- this.activityPageIndex = 1;
- let sendData = {
- cateId: this.cateId,
- pageIndex: this.activityPageIndex++,
- display: this.display,
- };
- if (this.searchVal) {
- sendData.keyword = this.searchVal;
- }
- uni.showLoading({
- title: "加载中...",
- });
- this.api.get("/Yx/GetActivityList", sendData).then((res) => {
- uni.stopPullDownRefresh();
- uni.hideLoading();
- this.activityList = res.data;
- if (res.data.length) {
- } else {
- self.isMoreEnd = true;
- }
- });
- },
-
- getMoreActivityList() {
- if (this.isMoreEnd) {
- return;
- }
- let sendData = {
- cateId: this.cateId,
- pageIndex: this.activityPageIndex++,
- display: this.display,
- };
- if (this.searchVal) {
- sendData.keyword = this.searchVal;
- }
- this.api.get("/Yx/GetActivityList", sendData).then((res) => {
- if (res.data.length) {
- this.activityList = this.activityList.concat(res.data);
- } else {
- self.isMoreEnd = true;
- }
- });
- },
-
- setActivityTop(val) {
- if (val.top > 0) {
-
- this.api
- .get("/Yx/CancelActivityTop", {
- aid: val.aid,
- })
- .then((res) => {
- if (res.success) {
- val.top = 0;
- this.$forceUpdate();
- this.fn.showToast("取消成功");
- } else {
- this.fn.showModal({
- title: "设置失败",
- content: res.message,
- showCancel: false,
- });
- }
- });
- } else {
-
- this.api
- .get("/Yx/SetActivityTop", {
- aid: val.aid,
- })
- .then((res) => {
- if (res.success) {
- val.top = 1;
- this.$forceUpdate();
- this.fn.showToast("置顶成功");
- } else {
- this.fn.showModal({
- title: "设置失败",
- content: res.message,
- showCancel: false,
- });
- }
- });
- }
- },
-
- setActivityDisplay(val) {
- let display = 0;
- if (val.display === 1) {
-
- display = 0;
- } else {
-
- display = 1;
- }
- this.api
- .get("/Yx/SetActivityDisplay", {
- aid: val.aid,
- display,
- })
- .then((res) => {
- if (res.success) {
- val.display = display;
- this.$forceUpdate();
- this.fn.showToast("设置成功");
- } else {
- this.fn.showModal({
- title: "设置失败",
- content: res.message,
- showCancel: false,
- });
- }
- });
- },
-
- pushGive(item,type) {
- let sendData = {
- pid: item.aid,
- aid: item.aid,
-
- platform:1000
- };
- if (type === "text") {
- sendData.sendTxt = false;
- sendData.sendVideo = false;
- sendData.sendImg = 0;
- } else {
-
-
-
- }
- this.api
- .get(this.otherUrl + "Home/sendproduct", sendData, {
- pass: true,
- })
- .then((res) => {
- this.fn.showToast(res.message);
- });
- },
-
- shareApp(val) {
- uni.navigateToMiniProgram({
- appId: "wx7d16ba51271496b8",
- path: `/pages/recommend/list?shopId=${this.shopId}&aid=${val.aid}`,
- extraData: {
- shopId: this.shopId,
- aid: val.aid,
- },
- });
- },
-
- search() {
- if (this.searchVal) {
- this.getActivityList();
- }
- },
-
- closeSearchVal() {
- this.searchVal = "";
- this.getActivityList();
- },
-
- goDetail(val) {
- this.$store.commit("common/update", {
- activityData: val,
- });
- this.router.push({
- path: "/pages/youxuan/good",
- query: {
- aid: val.aid,
- },
- });
- },
- },
-
- computed: {
-
- theme() {
- return this.$store.state.common.theme;
- },
- user() {
- return this.$store.state.user.user;
- },
- },
-
- watch: {},
- };
- </script>
- <style>
- page {
- height: 100%;
- background-color: #fff;
- }
- </style>
- <style lang="scss" scoped>
- .page {
- display: flex;
- flex-direction: column;
- height: 100%;
- &__top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: px(145);
- padding: 0 px(50);
- background-color: #fff;
-
- }
- &__content {
- position: relative;
- flex: 1;
- margin-top: px(5);
- }
- &__box {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 1;
- display: flex;
- justify-content: space-between;
- }
- &__right {
- display: flex;
- flex-direction: column;
- flex: 1;
- position: relative;
- }
- }
- .search {
- display: flex;
- align-items: center;
- width: 100%;
- height: px(86);
- padding: 0 px(35);
- background-color: #f8f8f8;
- border-radius: px(43);
- &__icon {
- margin-top: px(10);
- font-size: px(60);
- color: #999;
- }
- &__text {
- margin-left: px(15);
- font-size: px(36);
- color: #999;
- width: 100%;
- }
- }
- .service {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- &__icon {
- font-size: px(50);
- color: #666;
- }
- &__text {
- font-size: px(30);
- color: #666;
- }
- }
- .category {
- width: px(225);
- height: 100%;
- background-color: #f8f6f7;
- &__item {
- position: relative;
- display: flex;
- justify-content: center;
- font-size: px(40);
- color: #888;
- background-color: #f8f6f7;
- padding: px(60) 0;
- &--active {
-
- color: #333;
- background-color: #fff;
- &:before {
- content: "";
- position: absolute;
- top: 50%;
- left: 0;
- z-index: 1;
- display: block;
- width: px(8);
- height: 100%;
- transform: translateY(-50%);
- border-radius: px(4);
- background-color: #27a34f;
- }
- }
- }
- }
- .category-sub {
- position: relative;
- height: px(130);
- background-color: #fff;
- margin-right: px(140);
- margin-left: px(20);
- &__scroll {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: 1;
- }
- &__list {
- display: flex;
- align-items: center;
- height: 100%;
- }
- &__toggle {
- position: absolute;
- top: 0;
- right: px(-140);
- z-index: 2;
- width: px(140);
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: px(30);
- transform: rotate(90deg);
- &.active {
- transform: rotate(-90deg);
- }
- }
- &__item {
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- flex: none;
- height: 100%;
- font-size: px(34);
- width: px(220);
- color: #333;
- height: px(70);
- border-radius: px(35);
- background-color: #f6f6f6;
- border: 1px solid #f6f6f6;
- color: #888;
- margin: 0 px(10);
- &--active {
- color: #262626;
- background-color: rgba(39, 163, 79, 0.2);
- border: 1px solid #27a34f;
- color: #27a34f;
- }
- }
- }
- .category-sub-all {
- position: absolute;
- top: 0;
- left: 0;
- bottom: 0;
- width: 100%;
- z-index: 10;
- margin-top: px(130);
- &__bg {
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.3);
- }
- &__scroll {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 10;
- }
- &__list {
- display: flex;
- flex-wrap: wrap;
- background-color: #fff;
- padding: px(60) px(40);
- }
- &__item {
- display: flex;
- align-items: center;
- justify-content: center;
- flex: none;
- height: 100%;
- font-size: px(34);
- width: px(220);
- color: #333;
- height: px(70);
- border-radius: px(35);
- background-color: #f6f6f6;
- border: 1px solid #f6f6f6;
- color: #888;
- margin: 0 px(20) px(30);
- flex-shrink: 0;
- &--active {
- color: #262626;
- background-color: rgba(39, 163, 79, 0.2);
- border: 1px solid #27a34f;
- color: #27a34f;
- }
- }
- }
- .goods {
- position: relative;
- flex: 1;
- border-top: 1px solid #f6f6f6;
- &__scroll {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: 1;
- background-color: #fff;
- }
- &__list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- padding: px(35) 0 0 0;
- background-color: #fff;
- border-top: 1px solid #f6f6f6;
- }
- &__item {
- width: 100%;
- margin-bottom: px(60);
- border-bottom: 1px solid #f1f1f1;
- }
- .main {
- width: 100%;
- overflow: hidden;
-
- display: flex;
- justify-content: space-between;
- padding: 0 px(35);
- }
- &__img {
- flex-shrink: 0;
- margin-right: px(30);
- /deep/ img {
- width: px(230);
- height: px(230);
- }
- }
- &__info {
- display: flex;
- justify-content: space-between;
- flex-direction: column;
- align-items: flex-start;
- position: relative;
- width: 100%;
- }
- &__box {
- width: 100%;
- }
- &__title {
- width: 100%;
- @include omits(2);
- max-height: px(88);
- line-height: px(44);
- margin-top: px(30);
- font-size: px(38);
- color: #333;
- }
- &__price {
-
- }
- &__sale {
- font-size: px(34);
- line-height: px(40);
- color: #999;
- margin-top: px(20);
- span ~ span {
- margin-left: px(20);
- }
- &.flex {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- &.black {
- color: #666;
- }
- }
- &__present {
- font-size: px(36);
- color: #000;
- font-weight: 600;
- }
- &__original {
- position: relative;
- font-size: px(30);
- color: #999;
- margin-top: px(20);
- text-decoration: line-through;
- &:after {
- content: "";
- position: absolute;
- top: 50%;
- left: 0;
- z-index: 1;
- width: 100%;
- height: px(1);
- transform: translateY(-100%);
- background-color: #999;
- }
- }
- .btns {
- overflow: visible;
-
-
-
-
- width: 100%;
- display: flex;
- align-items: center;
- max-width: 100%;
- border-top: 1px solid #f1f1f1;
- margin-top: px(20);
- }
- .btn {
- width: 25%;
- height: px(100);
- line-height: px(100);
-
- color: #333;
- font-size: px(40);
- padding: 0 px(20);
- text-align: center;
- & ~ .btn {
- border-left: 1px solid #f1f1f1;
- }
- }
- .cart-num {
-
- padding: 0 px(30);
- box-sizing: border-box;
- min-width: px(60);
- }
- .num-input {
- overflow: visible;
- position: absolute;
- bottom: 0;
- right: 0;
- z-index: 1;
- }
- &__remove {
- background-color: #fff;
- width: px(60);
- height: px(60);
- border-radius: 50%;
- border: 1px solid #999;
- position: relative;
- &::after {
- content: "";
- position: absolute;
- top: 50%;
- left: 50%;
- z-index: 1;
- width: 60%;
- height: px(6);
- border-radius: px(6);
- background: #999;
- transform: translate(-50%, -50%);
- }
- }
- }
- .menu {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: px(110);
- margin-bottom: px(5);
- padding: 0 px(85);
- background-color: #fff;
-
- &__item {
- display: flex;
- align-items: center;
- }
- &__text {
- font-size: px(36);
- color: #888;
- }
- &__item--active &__text {
- color: #27a34f;
- }
- &__sort {
- margin-left: px(15);
- &:before {
- display: block;
- content: "";
- width: 0;
- height: 0;
- margin-bottom: px(10);
- border-width: px(12);
- border-style: solid;
- border-color: transparent transparent #ccc transparent;
- }
- &:after {
- display: block;
- content: "";
- width: 0;
- height: 0;
- border-width: px(12);
- border-style: solid;
- border-color: #ccc transparent transparent transparent;
- }
- &--up:before {
- border-color: transparent transparent #27a34f transparent;
- }
- &--down:after {
- border-color: #27a34f transparent transparent transparent;
- }
- }
- }
- .more-text {
- display: flex;
- justify-content: center;
- padding-bottom: px(60);
- font-size: px(34);
- color: #999;
- }
- .null {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding-top: px(115);
- &__img {
- width: px(576);
- height: px(281);
- }
- &__title {
- margin-top: px(60);
- font-size: px(40);
- color: #666;
- }
- }
- .page_red {
- /deep/ {
- .category {
- &__item {
- &--active {
- &:before {
- background-color: #fe6661;
- }
- }
- }
- }
- .category-sub {
- &__item {
- &--active {
- background-color: rgba(254, 102, 97, 0.2);
- border: 1px solid #fe6661;
- color: #fe6661;
- }
- }
- }
- .category-sub-all {
- &__item {
- &--active {
- color: #262626;
- background-color: rgba(254, 102, 97, 0.2);
- border: 1px solid #fe6661;
- color: #fe6661;
- }
- }
- }
- .goods {
- &__add-text {
- background-color: #fe6661;
- }
- &__add {
- background-color: #fe6661;
- box-shadow: px(1) px(2) px(6) #fe6661;
- }
- }
- .menu {
- .menu__item--active .menu__text {
- color: #fe6661;
- }
- &__sort {
- &--up:before {
- border-color: transparent transparent #fe6661 transparent;
- }
- &--down:after {
- border-color: #fe6661 transparent transparent transparent;
- }
- }
- }
- }
- }
- .item_one {
- border-bottom: 3px solid #c9c9c9;
- background-color: #efefef;
- padding: px(20) 0;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .switch {
- transform: scale(0.7);
- }
- .canvas {
- position: fixed;
- top: -100%;
- left: -100%;
- z-index: -11;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.4);
- visibility: hidden;
- &__content {
- position: relative;
- width: 100%;
- height: 100%;
- padding: px(200) px(80) 0;
- z-index: 10;
- }
- &__close {
- position: absolute;
- top: px(50);
- right: px(120);
- z-index: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- width: px(100);
- height: px(100);
- border-radius: 50%;
- border: solid px(3) #fff;
- &:after {
- content: "";
- position: absolute;
- top: px(100);
- left: 50%;
- z-index: 1;
- display: block;
- width: px(3);
- height: px(50);
- transform: translateX(-50%);
- background-color: #fff;
- }
- }
- &__img {
- width: px(60);
- height: px(60);
- }
- &__box {
- width: px(920);
- height: px(1483);
- background-color: #fff;
- }
- }
- .remove-icon {
- padding-left: px(20);
- }
- .quick-add {
- font-size: px(44);
- color: rgb(0, 188, 38);
- flex-shrink: 0;
- margin-right: px(30);
- }
- .status-tab {
- display: flex;
- justify-content: center;
- font-size: px(44);
- text-align: center;
- margin: px(40) 0;
- span {
- border: 1px solid #f1f1f1;
- padding: px(20) 0;
- width: 40%;
- flex-shrink: 0;
- &.on {
- border-color: rgb(0, 188, 38);
- color: rgb(0, 188, 38);
- }
- }
- }
- </style>
|