|
@@ -1,173 +1,193 @@
|
|
|
<template>
|
|
|
- <view>
|
|
|
- <tabs ref="tabs" typename="renderingstype" @getList="getList" />
|
|
|
- <float-but @onClick="toUpload" />
|
|
|
- <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
|
|
|
- <design-list ref="designList" :list="list" @toDetail="toDetail" />
|
|
|
- </My_listbox>
|
|
|
- </view>
|
|
|
+ <view>
|
|
|
+ <tabs ref="tabs" typename="renderingstype" @getList="getList" />
|
|
|
+ <float-but @onClick="toUpload" />
|
|
|
+ <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
|
|
|
+ <design-list ref="designList" :list="list" @toDetail="toDetail" />
|
|
|
+ </My_listbox>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import tabs from "./tabs.vue"
|
|
|
+import tabs from "./tabs.vue";
|
|
|
import designList from "../../../../components/designList.vue";
|
|
|
|
|
|
export default {
|
|
|
- components: { tabs, designList },
|
|
|
- props: {
|
|
|
- pageType: {
|
|
|
- type: String,
|
|
|
- default: "设计"
|
|
|
- }
|
|
|
+ components: { tabs, designList },
|
|
|
+ props: {
|
|
|
+ pageType: {
|
|
|
+ type: String,
|
|
|
+ default: "设计",
|
|
|
},
|
|
|
- name: "design",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- "content": {
|
|
|
- isnationwide: 1,
|
|
|
- "where": {
|
|
|
- "condition": "",
|
|
|
- "style": "",
|
|
|
- "space": "",
|
|
|
- "spec": "",
|
|
|
- }
|
|
|
- },
|
|
|
- list: [],
|
|
|
- isInitialize: false
|
|
|
- }
|
|
|
+ },
|
|
|
+ name: "design",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ content: {
|
|
|
+ where: {
|
|
|
+ condition: "",
|
|
|
+ style: "",
|
|
|
+ space: "",
|
|
|
+ spec: "",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ isInitialize: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ if (this.isInitialize) return;
|
|
|
+ this.setTypes();
|
|
|
+ this.getList();
|
|
|
},
|
|
|
- methods: {
|
|
|
- init() {
|
|
|
- if (this.isInitialize) return;
|
|
|
- this.setTypes();
|
|
|
- this.getList();
|
|
|
+ setTypes() {
|
|
|
+ let types = [
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ remarks: "全国精选",
|
|
|
},
|
|
|
- setTypes() {
|
|
|
- let types = [{
|
|
|
- value: "1",
|
|
|
- remarks: "全国精选"
|
|
|
- }];
|
|
|
- types.push([21, 22].includes(uni.getStorageSync('userMsg').usertype) ? {
|
|
|
- value: "0",
|
|
|
- remarks: "门店" + this.pageType
|
|
|
- } : {
|
|
|
- value: "0",
|
|
|
- remarks: "全国" + this.pageType
|
|
|
+ ];
|
|
|
+ //经销商和经销商员工
|
|
|
+ if ([21, 22].includes(uni.getStorageSync("userMsg").usertype)) {
|
|
|
+ types.push({
|
|
|
+ value: "2",
|
|
|
+ remarks: "门店" + this.pageType,
|
|
|
+ });
|
|
|
+ } else if (99 == uni.getStorageSync("userMsg").usertype) {
|
|
|
+ //消费者
|
|
|
+ } else {
|
|
|
+ //其他
|
|
|
+ types.push({
|
|
|
+ value: "2",
|
|
|
+ remarks: "门店" + this.pageType,
|
|
|
+ });
|
|
|
+ types.push({
|
|
|
+ value: "3",
|
|
|
+ remarks: "全国" + this.pageType,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.$refs.tabs.tabs = types;
|
|
|
+ this.$refs.tabs.active = types[0].value;
|
|
|
+ this.$refs.tabs.setWidths();
|
|
|
+ },
|
|
|
+ getList(init = false) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (this.paging(this.content, init)) return;
|
|
|
+ let content = this.content;
|
|
|
+ let ref = this.$refs.tabs;
|
|
|
+ if (ref.active == null) this.setTypes();
|
|
|
+ content.querytype = ref.active;
|
|
|
+ content.where = {
|
|
|
+ ...content.where,
|
|
|
+ ...ref.where,
|
|
|
+ type: this.pageType == "设计" ? "4" : "5",
|
|
|
+ };
|
|
|
+ this.$Http
|
|
|
+ .basic({
|
|
|
+ id: 20240417144702,
|
|
|
+ content: this.content,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ resolve();
|
|
|
+ this.$refs.List.RefreshToComplete();
|
|
|
+ this.$refs.List.setHeight();
|
|
|
+ console.log(`获取${this.pageType}列表`, res);
|
|
|
+ if (this.cutoff(res.msg)) return;
|
|
|
+ this.isInitialize = true;
|
|
|
+ this.$refs.designList.handleList(res.data);
|
|
|
+ this.list =
|
|
|
+ res.pageNumber == 1 ? res.data : this.list.concat(res.data);
|
|
|
+ this.content = this.$refs.List.paging(this.content, res);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ updateList(data = null) {
|
|
|
+ if (this.content.pageNumber && this.content.pageNumber >= 2) {
|
|
|
+ let that = this;
|
|
|
+ let content = this.paging(this.content, true, true);
|
|
|
+ this.$Http
|
|
|
+ .basic({
|
|
|
+ id: "20240417144702",
|
|
|
+ content,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log("更新列表", res);
|
|
|
+ if (this.cutoff(res.msg)) return;
|
|
|
+ res.data = res.data.map((v) => {
|
|
|
+ v.cover = v.attinfos.length
|
|
|
+ ? this.getSpecifiedImage(
|
|
|
+ v.attinfos.find((s) => s.usetype == "sat_sharematerial") ||
|
|
|
+ v.attinfos[0]
|
|
|
+ )
|
|
|
+ : uni.getStorageSync("site").logo || "";
|
|
|
+ return v;
|
|
|
});
|
|
|
- this.$refs.tabs.tabs = types;
|
|
|
- this.$refs.tabs.active = "1";
|
|
|
- this.$refs.tabs.setWidths();
|
|
|
- },
|
|
|
- getList(init = false) {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- if (this.paging(this.content, init)) return;
|
|
|
- let content = this.content;
|
|
|
- let ref = this.$refs.tabs;
|
|
|
- if (ref.active == null) this.setTypes()
|
|
|
- content.isnationwide = ref.active;
|
|
|
- content.where = {
|
|
|
- ...content.where,
|
|
|
- ...ref.where,
|
|
|
- "type": this.pageType == '设计' ? "4" : '5',
|
|
|
- }
|
|
|
- this.$Http.basic({
|
|
|
- "id": 20240417144702,
|
|
|
- content: this.content
|
|
|
- }).then(res => {
|
|
|
- resolve()
|
|
|
- this.$refs.List.RefreshToComplete()
|
|
|
- this.$refs.List.setHeight()
|
|
|
- console.log(`获取${this.pageType}列表`, res)
|
|
|
- if (this.cutoff(res.msg)) return;
|
|
|
- this.isInitialize = true;
|
|
|
- this.$refs.designList.handleList(res.data)
|
|
|
- this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
|
|
|
- this.content = this.$refs.List.paging(this.content, res)
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- updateList(data = null) {
|
|
|
- if (this.content.pageNumber && this.content.pageNumber >= 2) {
|
|
|
- let that = this;
|
|
|
- if (data.isnationwide != this.content.isnationwide) return handle();
|
|
|
- let content = this.paging(this.content, true, true)
|
|
|
-
|
|
|
- this.$Http.basic({
|
|
|
- "id": "20240417144702",
|
|
|
- content
|
|
|
- }).then(res => {
|
|
|
- console.log("更新列表", res)
|
|
|
- if (this.cutoff(res.msg)) return;
|
|
|
- res.data = res.data.map(v => {
|
|
|
- v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "sat_sharematerial") || v.attinfos[0]) : uni.getStorageSync("site").logo || ''
|
|
|
- return v
|
|
|
- })
|
|
|
- this.list = res.data;
|
|
|
- this.$refs.List.paging(content, res, true)
|
|
|
- if (data) handle();
|
|
|
-
|
|
|
- })
|
|
|
- function handle() {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '新建成功,是否立即查看',
|
|
|
- cancelText: '返回列表',
|
|
|
- confirmText: '查看详情',
|
|
|
- success: ({ confirm }) => {
|
|
|
- if (confirm) {
|
|
|
- let index = that.list.findIndex(v => v.sat_sharematerialid == data.sat_sharematerialid);
|
|
|
- if (index == -1) {
|
|
|
- uni.redirectTo({
|
|
|
- url: `/packageA/fullView/detail?id=${data.sat_sharematerialid}`
|
|
|
- });
|
|
|
- that.$Http.setCount = null;
|
|
|
- } else {
|
|
|
- that.toDetail(index, 2)
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.navigateBack();
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
+ this.list = res.data;
|
|
|
+ this.$refs.List.paging(content, res, true);
|
|
|
+ if (data) handle();
|
|
|
+ });
|
|
|
+ function handle() {
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "新建成功,是否立即查看",
|
|
|
+ cancelText: "返回列表",
|
|
|
+ confirmText: "查看详情",
|
|
|
+ success: ({ confirm }) => {
|
|
|
+ if (confirm) {
|
|
|
+ let index = that.list.findIndex(
|
|
|
+ (v) => v.sat_sharematerialid == data.sat_sharematerialid
|
|
|
+ );
|
|
|
+ if (index == -1) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/packageA/fullView/detail?id=${data.sat_sharematerialid}`,
|
|
|
+ });
|
|
|
+ that.$Http.setCount = null;
|
|
|
+ } else {
|
|
|
+ that.toDetail(index, 2);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- toDetail(index, type = 1) {
|
|
|
- let item = this.list[index]
|
|
|
- if (type == 1) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.redirectTo({
|
|
|
- url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
|
|
|
- });
|
|
|
- }
|
|
|
- this.$Http.setCount = function (detail) {
|
|
|
- item.collectcount = detail.collectcount;
|
|
|
- item.commentcount = detail.commentcount;
|
|
|
- item.likecount = detail.likecount;
|
|
|
- item.islike = detail.islike;
|
|
|
- item.iscollect = detail.iscollect;
|
|
|
- this.$set(this.list, index, item)
|
|
|
- }.bind(this)
|
|
|
- },
|
|
|
- toUpload() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/packageA/fullView/upload?pageType=' + this.pageType,
|
|
|
- })
|
|
|
- this.$Http.updateList = this.updateList.bind(this);
|
|
|
+ } else {
|
|
|
+ uni.navigateBack();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
-}
|
|
|
+ toDetail(index, type = 1) {
|
|
|
+ let item = this.list[index];
|
|
|
+ if (type == 1) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.$Http.setCount = function (detail) {
|
|
|
+ item.collectcount = detail.collectcount;
|
|
|
+ item.commentcount = detail.commentcount;
|
|
|
+ item.likecount = detail.likecount;
|
|
|
+ item.islike = detail.islike;
|
|
|
+ item.iscollect = detail.iscollect;
|
|
|
+ this.$set(this.list, index, item);
|
|
|
+ }.bind(this);
|
|
|
+ },
|
|
|
+ toUpload() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/packageA/fullView/upload?pageType=" + this.pageType,
|
|
|
+ });
|
|
|
+ this.$Http.updateList = this.updateList.bind(this);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
page,
|
|
|
body {
|
|
|
- height: 100vh;
|
|
|
- overflow: hidden;
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
</style>
|