zs 1 vuosi sitten
vanhempi
commit
1b57a7679d

+ 31 - 32
pagesHome/picture/index.vue

@@ -3,14 +3,14 @@
 		<view class="top">
 			<view v-for="(item,index) in imageList" :key="index" @tap="swichMenu(index)">
 				<text :class="[current == index ? 'border' : '']"
-					class="text">{{item.name}}({{item.url.length||0}})</text>
+					class="text">{{item.name}}({{item?.url?.length||0}})</text>
 			</view>
 		</view>
 		<view class="info">
 			<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" :scroll-into-view="itemId">
 				<view class="list-scroll-view">
 					<view class="one" v-for="(item,index) in imageList" :key="index">
-						<view class="text" :id="'item' + index">{{item.name}}({{item.url.length||0}})</view>
+						<view class="text" :id="'item' + index">{{item.name}}({{item?.url?.length||0}})</view>
 						<u-album :urls="item.url" @albumWidth="width => albumWidth = width"
 							multipleSize="110"></u-album>
 					</view>
@@ -44,39 +44,13 @@
 	})
 	// 基本信息
 	const config = ref({});
-	const type = ref('');
+	const id = ref('');
 	const current = ref(0);
 	const itemId = ref(''); // 栏目右边scroll-view用于滚动的id
-	const imageList = ref([{
-		name: '外观', url: [
-			'https://cdn.uviewui.com/uview/album/1.jpg',
-			'https://cdn.uviewui.com/uview/album/2.jpg',
-			'https://cdn.uviewui.com/uview/album/3.jpg',
-			'https://cdn.uviewui.com/uview/album/4.jpg',
-			'https://cdn.uviewui.com/uview/album/5.jpg',
-			'https://cdn.uviewui.com/uview/album/6.jpg',
-			'https://cdn.uviewui.com/uview/album/7.jpg',
-			'https://cdn.uviewui.com/uview/album/8.jpg',
-			'https://cdn.uviewui.com/uview/album/9.jpg'
-		]
-	},
-	{
-		name: '内饰', url: [
-			'https://cdn.uviewui.com/uview/album/1.jpg',
-			'https://cdn.uviewui.com/uview/album/2.jpg',
-			'https://cdn.uviewui.com/uview/album/10.jpg'
-		]
-	},
-	{
-		name: '空间', url: [
-			'https://cdn.uviewui.com/uview/album/7.jpg',
-			'https://cdn.uviewui.com/uview/album/8.jpg',
-			'https://cdn.uviewui.com/uview/album/9.jpg'
-		]
-	}]);
+	const imageList = ref([{ name: '外观', url: [] }, { name: '内饰', url: [] }, { name: '空间', url: [] }]);
 
 	onLoad(async (options) => {
-		type.value = options && options.id
+		id.value = options && options.id
 		await searchConfig();
 		await searchOther();
 		await search();
@@ -90,7 +64,32 @@
 		config.value = uni.getStorageSync('config');
 	};
 	// 查询
-	const search = async () => { };
+	const search = async () => {
+		if (id.value) {
+			const res = await $api(`car/${id.value}`, 'GET', {});
+			if (res.errcode === 0) {
+				if (res.data?.file?.length > 0) {
+					res.data.file = res.data.file.map((item, index) => {
+						return item.url
+					})
+					var one = res.data.file.slice(0, 9);
+					var two = res.data.file.slice(9, 18);
+					var thr = res.data.file.slice(18, 21);
+					imageList.value = imageList.value.map((item, index) => {
+						if (index == 0) item.url = one
+						else if (index == 1) item.url = two
+						else if (index == 2) item.url = thr
+						return item
+					})
+				}
+			} else {
+				uni.showToast({
+					title: res.errmsg || '',
+					icon: 'error',
+				});
+			}
+		}
+	};
 	// 联系卖家
 	const toChat = (item) => {
 		uni.makePhoneCall({

+ 20 - 43
pagesHome/shop/index.vue

@@ -4,7 +4,7 @@
 			<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
 				<view class="list-scroll-view">
 					<view class="top">
-						<image class="image" src="https://cdn.uviewui.com/uview/album/1.jpg" />
+						<image class="image" :src="shop.logo&&shop.logo?.length>0?shop.logo[0].url:'https://cdn.uviewui.com/uview/album/1.jpg'" />
 					</view>
 					<view class="bottom">
 						<view class="one">
@@ -22,7 +22,7 @@
 										<span>{{shop.status=='0'?'营业中':'休息中'}}</span>&nbsp;
 										<span>{{shop.start_time||'8:00'}}-{{shop.end_time||'17:00'}}</span>
 									</view>
-									<view class="left_3">
+									<view class="left_3" @tap="toImage">
 										<u-icon name="file-text" size="16"></u-icon>
 										<text>营业执照</text>
 									</view>
@@ -180,47 +180,6 @@
 	const moneyInfo = ref({});
 	const yearInfo = ref({});
 	const moreList = ref([]);
-	// 字典表
-	const typeList = ref([
-		{
-			title: '5万以下',
-			type: '0',
-		},
-		{
-			title: '5-10万',
-			type: '1',
-		},
-		{
-			title: '10-15万',
-			type: '2',
-		},
-		{
-			title: '更多条件',
-			type: '3',
-		}
-	]);
-	const carList = ref([
-		{
-			title: '大众',
-			type: '0',
-		},
-		{
-			title: '宝马',
-			type: '1',
-		},
-		{
-			title: '本田',
-			type: '2',
-		},
-		{
-			title: '丰田',
-			type: '3',
-		},
-		{
-			title: '更多品牌',
-			type: '4',
-		}
-	]);
 	// 列表
 	const list = ref([]);
 	const total = ref(0);
@@ -410,6 +369,24 @@
 			url: `/pagesHome/car/index?id=${item.id || item._id}`
 		})
 	};
+	// 预览营业执照
+	const toImage = () => {
+		if (shop.value?.file.length > 0) {
+			// 预览图片
+			uni.previewImage({
+				urls: [shop.value.file[0].url],
+				longPressActions: {
+					itemList: ['发送给朋友', '保存图片', '收藏'],
+					success: function (data) {
+						console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
+					},
+					fail: function (err) {
+						console.log(err.errMsg);
+					}
+				}
+			});
+		}
+	};
 	// 分页
 	const toPage = () => {
 		if (total.value > list.value.length) {

+ 36 - 37
unpackage/dist/dev/mp-weixin/pagesHome/picture/index.js

@@ -14,48 +14,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "index",
   setup(__props) {
     var _a;
-    (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
+    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
     common_vendor.computed(() => {
       return common_vendor.index.getStorageSync("openid");
     });
     const config = common_vendor.ref({});
-    const type = common_vendor.ref("");
+    const id = common_vendor.ref("");
     const current = common_vendor.ref(0);
     const itemId = common_vendor.ref("");
-    const imageList = common_vendor.ref([
-      {
-        name: "外观",
-        url: [
-          "https://cdn.uviewui.com/uview/album/1.jpg",
-          "https://cdn.uviewui.com/uview/album/2.jpg",
-          "https://cdn.uviewui.com/uview/album/3.jpg",
-          "https://cdn.uviewui.com/uview/album/4.jpg",
-          "https://cdn.uviewui.com/uview/album/5.jpg",
-          "https://cdn.uviewui.com/uview/album/6.jpg",
-          "https://cdn.uviewui.com/uview/album/7.jpg",
-          "https://cdn.uviewui.com/uview/album/8.jpg",
-          "https://cdn.uviewui.com/uview/album/9.jpg"
-        ]
-      },
-      {
-        name: "内饰",
-        url: [
-          "https://cdn.uviewui.com/uview/album/1.jpg",
-          "https://cdn.uviewui.com/uview/album/2.jpg",
-          "https://cdn.uviewui.com/uview/album/10.jpg"
-        ]
-      },
-      {
-        name: "空间",
-        url: [
-          "https://cdn.uviewui.com/uview/album/7.jpg",
-          "https://cdn.uviewui.com/uview/album/8.jpg",
-          "https://cdn.uviewui.com/uview/album/9.jpg"
-        ]
-      }
-    ]);
+    const imageList = common_vendor.ref([{ name: "外观", url: [] }, { name: "内饰", url: [] }, { name: "空间", url: [] }]);
     common_vendor.onLoad(async (options) => {
-      type.value = options && options.id;
+      id.value = options && options.id;
       await searchConfig();
       await searchOther();
       await search();
@@ -66,6 +35,34 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       config.value = common_vendor.index.getStorageSync("config");
     };
     const search = async () => {
+      var _a2, _b;
+      if (id.value) {
+        const res = await $api(`car/${id.value}`, "GET", {});
+        if (res.errcode === 0) {
+          if (((_b = (_a2 = res.data) == null ? void 0 : _a2.file) == null ? void 0 : _b.length) > 0) {
+            res.data.file = res.data.file.map((item, index) => {
+              return item.url;
+            });
+            var one = res.data.file.slice(0, 9);
+            var two = res.data.file.slice(9, 18);
+            var thr = res.data.file.slice(18, 21);
+            imageList.value = imageList.value.map((item, index) => {
+              if (index == 0)
+                item.url = one;
+              else if (index == 1)
+                item.url = two;
+              else if (index == 2)
+                item.url = thr;
+              return item;
+            });
+          }
+        } else {
+          common_vendor.index.showToast({
+            title: res.errmsg || "",
+            icon: "error"
+          });
+        }
+      }
     };
     const toChat = (item) => {
       common_vendor.index.makePhoneCall({
@@ -87,18 +84,20 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     return (_ctx, _cache) => {
       return {
         a: common_vendor.f(imageList.value, (item, index, i0) => {
+          var _a2;
           return {
             a: common_vendor.t(item.name),
-            b: common_vendor.t(item.url.length || 0),
+            b: common_vendor.t(((_a2 = item == null ? void 0 : item.url) == null ? void 0 : _a2.length) || 0),
             c: common_vendor.n(current.value == index ? "border" : ""),
             d: index,
             e: common_vendor.o(($event) => swichMenu(index), index)
           };
         }),
         b: common_vendor.f(imageList.value, (item, index, i0) => {
+          var _a2;
           return {
             a: common_vendor.t(item.name),
-            b: common_vendor.t(item.url.length || 0),
+            b: common_vendor.t(((_a2 = item == null ? void 0 : item.url) == null ? void 0 : _a2.length) || 0),
             c: "item" + index,
             d: common_vendor.o((width) => _ctx.albumWidth = width, index),
             e: "0d1a9630-0-" + i0,

+ 62 - 82
unpackage/dist/dev/mp-weixin/pagesHome/shop/index.js

@@ -34,46 +34,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const moneyInfo = common_vendor.ref({});
     const yearInfo = common_vendor.ref({});
     const moreList = common_vendor.ref([]);
-    common_vendor.ref([
-      {
-        title: "5万以下",
-        type: "0"
-      },
-      {
-        title: "5-10万",
-        type: "1"
-      },
-      {
-        title: "10-15万",
-        type: "2"
-      },
-      {
-        title: "更多条件",
-        type: "3"
-      }
-    ]);
-    common_vendor.ref([
-      {
-        title: "大众",
-        type: "0"
-      },
-      {
-        title: "宝马",
-        type: "1"
-      },
-      {
-        title: "本田",
-        type: "2"
-      },
-      {
-        title: "丰田",
-        type: "3"
-      },
-      {
-        title: "更多品牌",
-        type: "4"
-      }
-    ]);
     const list = common_vendor.ref([]);
     const total = common_vendor.ref(0);
     const skip = common_vendor.ref(0);
@@ -265,6 +225,23 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         url: `/pagesHome/car/index?id=${item.id || item._id}`
       });
     };
+    const toImage = () => {
+      var _a2;
+      if (((_a2 = shop.value) == null ? void 0 : _a2.file.length) > 0) {
+        common_vendor.index.previewImage({
+          urls: [shop.value.file[0].url],
+          longPressActions: {
+            itemList: ["发送给朋友", "保存图片", "收藏"],
+            success: function(data) {
+              console.log("选中了第" + (data.tapIndex + 1) + "个按钮,第" + (data.index + 1) + "张图片");
+            },
+            fail: function(err) {
+              console.log(err.errMsg);
+            }
+          }
+        });
+      }
+    };
     const toPage = () => {
       if (total.value > list.value.length) {
         common_vendor.index.showLoading({
@@ -279,22 +256,25 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         is_bottom.value = true;
     };
     return (_ctx, _cache) => {
+      var _a2;
       return common_vendor.e({
-        a: common_vendor.t(shop.value.name || "暂无"),
-        b: common_vendor.t(shop.value.sale || "0"),
-        c: common_vendor.t(shop.value.sold || "0"),
-        d: common_vendor.t(shop.value.status == "0" ? "营业中" : "休息中"),
-        e: common_vendor.t(shop.value.start_time || "8:00"),
-        f: common_vendor.t(shop.value.end_time || "17:00"),
-        g: common_vendor.p({
+        a: shop.value.logo && ((_a2 = shop.value.logo) == null ? void 0 : _a2.length) > 0 ? shop.value.logo[0].url : "https://cdn.uviewui.com/uview/album/1.jpg",
+        b: common_vendor.t(shop.value.name || "暂无"),
+        c: common_vendor.t(shop.value.sale || "0"),
+        d: common_vendor.t(shop.value.sold || "0"),
+        e: common_vendor.t(shop.value.status == "0" ? "营业中" : "休息中"),
+        f: common_vendor.t(shop.value.start_time || "8:00"),
+        g: common_vendor.t(shop.value.end_time || "17:00"),
+        h: common_vendor.p({
           name: "file-text",
           size: "16"
         }),
-        h: common_vendor.p({
+        i: common_vendor.o(toImage),
+        j: common_vendor.p({
           direction: "col"
         }),
-        i: common_vendor.t(shop.value.address || "暂无"),
-        j: common_vendor.f(searchList.value, (item, index, i0) => {
+        k: common_vendor.t(shop.value.address || "暂无"),
+        l: common_vendor.f(searchList.value, (item, index, i0) => {
           return common_vendor.e({
             a: common_vendor.t(item.title),
             b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
@@ -318,9 +298,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
             i: common_vendor.o(($event) => toSearch(item), index)
           });
         }),
-        k: type.value == "0"
+        m: type.value == "0"
       }, type.value == "0" ? {
-        l: common_vendor.f(sortList.value, (item, index, i0) => {
+        n: common_vendor.f(sortList.value, (item, index, i0) => {
           return {
             a: common_vendor.t(item.title),
             b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
@@ -329,7 +309,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           };
         })
       } : type.value == "2" ? {
-        n: common_vendor.f(moneyList.value, (item, index, i0) => {
+        p: common_vendor.f(moneyList.value, (item, index, i0) => {
           return {
             a: common_vendor.t(item.title),
             b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
@@ -338,7 +318,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           };
         })
       } : type.value == "3" ? {
-        p: common_vendor.f(yearList.value, (item, index, i0) => {
+        r: common_vendor.f(yearList.value, (item, index, i0) => {
           return {
             a: common_vendor.t(item.title),
             b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
@@ -347,7 +327,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           };
         })
       } : {
-        q: common_vendor.f(yearList.value, (item, index, i0) => {
+        s: common_vendor.f(yearList.value, (item, index, i0) => {
           return {
             a: common_vendor.t(item.title),
             b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
@@ -356,45 +336,45 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           };
         })
       }, {
-        m: type.value == "2",
-        o: type.value == "3",
-        r: is_show.value,
-        s: common_vendor.o(toClose),
-        t: Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || Object.keys(yearInfo.value).length > 0 || moreList.value.length > 0
+        o: type.value == "2",
+        q: type.value == "3",
+        t: is_show.value,
+        v: common_vendor.o(toClose),
+        w: Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || Object.keys(yearInfo.value).length > 0 || moreList.value.length > 0
       }, Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || Object.keys(yearInfo.value).length > 0 || moreList.value.length > 0 ? common_vendor.e({
-        v: brandInfo.value && brandInfo.value.type
+        x: brandInfo.value && brandInfo.value.type
       }, brandInfo.value && brandInfo.value.type ? {
-        w: common_vendor.t(brandInfo.value.title),
-        x: common_vendor.p({
+        y: common_vendor.t(brandInfo.value.title),
+        z: common_vendor.p({
           color: "#000",
           size: "14px",
           name: "close"
         }),
-        y: common_vendor.o(($event) => toDelete({}, "0"))
+        A: common_vendor.o(($event) => toDelete({}, "0"))
       } : {}, {
-        z: moneyInfo.value && moneyInfo.value.type
+        B: moneyInfo.value && moneyInfo.value.type
       }, moneyInfo.value && moneyInfo.value.type ? {
-        A: common_vendor.t(moneyInfo.value.title),
-        B: common_vendor.p({
+        C: common_vendor.t(moneyInfo.value.title),
+        D: common_vendor.p({
           color: "#000",
           size: "14px",
           name: "close"
         }),
-        C: common_vendor.o(($event) => toDelete({}, "1"))
+        E: common_vendor.o(($event) => toDelete({}, "1"))
       } : {}, {
-        D: yearInfo.value && yearInfo.value.type
+        F: yearInfo.value && yearInfo.value.type
       }, yearInfo.value && yearInfo.value.type ? {
-        E: common_vendor.t(yearInfo.value.title),
-        F: common_vendor.p({
+        G: common_vendor.t(yearInfo.value.title),
+        H: common_vendor.p({
           color: "#000",
           size: "14px",
           name: "close"
         }),
-        G: common_vendor.o(($event) => toDelete({}, "2"))
+        I: common_vendor.o(($event) => toDelete({}, "2"))
       } : {}, {
-        H: moreList.value.length > 0
+        J: moreList.value.length > 0
       }, moreList.value.length > 0 ? {
-        I: common_vendor.f(moreList.value, (item, index, i0) => {
+        K: common_vendor.f(moreList.value, (item, index, i0) => {
           return {
             a: common_vendor.t(item.title),
             b: "88a3d2e5-7-" + i0,
@@ -402,15 +382,15 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
             d: common_vendor.o(($event) => toDelete(item, "3"), index)
           };
         }),
-        J: common_vendor.p({
+        L: common_vendor.p({
           color: "#000",
           size: "14px",
           name: "close"
         })
       } : {}, {
-        K: common_vendor.o(toReset)
+        M: common_vendor.o(toReset)
       }) : {}, {
-        L: common_vendor.f(list.value, (item, index, i0) => {
+        N: common_vendor.f(list.value, (item, index, i0) => {
           return common_vendor.e({
             a: item.file && item.file.length > 0 ? item.file[0].url : "",
             b: common_vendor.t(item.series || "暂无"),
@@ -433,13 +413,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
             m: common_vendor.o(($event) => toView(item), index)
           });
         }),
-        M: is_bottom.value
+        O: is_bottom.value
       }, is_bottom.value ? {
-        N: common_vendor.t(config.value.bottom_title || "没有更多了!")
+        P: common_vendor.t(config.value.bottom_title || "没有更多了!")
       } : {}, {
-        O: common_vendor.o(toPage),
-        P: common_vendor.o(toChat),
-        Q: common_vendor.p({
+        Q: common_vendor.o(toPage),
+        R: common_vendor.o(toChat),
+        S: common_vendor.p({
           icon: "phone",
           text: "电话联系",
           size: "normal",

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/shop/index.wxml