xiaohaizhao 1 рік тому
батько
коміт
63a6c65561

+ 134 - 0
components/storeInfo.vue

@@ -0,0 +1,134 @@
+<template>
+    <view class="store-info" v-if="detail.sys_enterpriseid" :style="{
+        marginTop: tovw(marTop),
+        marginBottom: tovw(marBot),
+    }">
+        <view class="title">
+            {{ title }}
+        </view>
+        <view class="content">
+            <u--image width="60" height="62" radius="8" :src="detail.cover" lazy-load>
+                <template v-slot:loading>
+                    <u-loading-icon color="red"></u-loading-icon>
+                </template>
+            </u--image>
+            <view class="text-box" hover-class="navigator-hover" @click="goAtOnce(detail)">
+                <view class="storename u-line-1" :style="{ width: detail.phoneNumber ? '230px' : '100%' }">
+                    {{ detail.storename }}
+                </view>
+                <view class="address u-line-1" :style="{ width: detail.phoneNumber ? '230px' : '100%' }">
+                    <text class="iconfont icon-dizhi-hui" />{{ getCity(detail) }}
+                </view>
+                <view v-if="detail.phoneNumber" @click.stop="callPhone(detail.phoneNumber)" class="iconfont icon-dianhua"
+                    hover-class="navigator-hover" />
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+export default {
+    name: "storeInfo",
+    props: {
+        title: {
+            type: String,
+            default: "门店信息"
+        },
+        marTop: {
+            type: [Number || String],
+            default: 0
+        },
+        marBot: {
+            type: [Number || String],
+            default: 0
+        }
+    },
+    watch: {
+        detail: function (newVal) {
+            this.$emit("门店detail", newVal)
+        }
+    },
+    data() {
+        return {
+            detail: uni.getStorageSync("shop") || { sys_enterpriseid: 0 }
+        }
+    },
+    methods: {
+        goAtOnce(item) {
+            uni.openLocation({
+                latitude: item.latitude - 0,
+                longitude: item.longitude - 0,
+                address: item.address,
+                name: item.storename,
+                success: function () {
+                    console.log('success');
+                },
+                fail: (fail) => {
+                    console.log('fail', fail)
+                },
+            });
+        },
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.store-info {
+    background: #fff;
+    padding: 10px;
+    padding-top: 12px;
+
+    .title {
+        line-height: 22px;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: bold;
+        font-size: 16px;
+        color: #333333;
+    }
+
+    .content {
+        display: flex;
+        margin-top: 11px;
+
+        .text-box {
+            position: relative;
+            flex: 1;
+            height: 62px;
+            background: #F5F5F5;
+            border-radius: 5px;
+            margin-left: 10px;
+            box-sizing: border-box;
+            padding: 10px;
+
+            .storename {
+                line-height: 20px;
+                font-family: PingFang SC, PingFang SC;
+                font-size: 14px;
+                color: #333333;
+            }
+
+            .address {
+                .iconfont {
+                    font-size: 12px;
+                    margin-right: 4px;
+                }
+
+                line-height: 17px;
+                font-family: PingFang SC,
+                PingFang SC;
+                font-size: 12px;
+                color: #888888;
+                margin-top: 5px;
+            }
+
+            .icon-dianhua {
+                position: absolute;
+                right: 20px;
+                top: 20px;
+                font-size: 20px;
+                color: #C30D23;
+            }
+        }
+    }
+}
+</style>

+ 4 - 0
main.js

@@ -19,6 +19,10 @@ import floatBut from './components/floatBut.vue';
 Vue.component("floatBut", floatBut);
 import slideshow from './components/slideshow.vue';
 Vue.component("slideshow", slideshow);
+import storeInfo from './components/storeInfo.vue';
+Vue.component("storeInfo", storeInfo);
+
+
 
 //挂载接口
 let isDev = process.env.NODE_ENV === 'development';

+ 2 - 8
packageA/shop/history.vue

@@ -3,7 +3,7 @@
         <My_listbox ref="List" @getlist="getList">
             <view class="item" @click="changeShop(index)" v-for="(item, index) in list" :key="item.sa_storeid"
                 hover-class="navigator-hover">
-                <image class="logo" :src="logo" />
+                <image class="logo" :src="item.cover" />
                 <view class="content">
                     <view class="label u-line-1">
                         {{ item.storename }}
@@ -32,7 +32,6 @@ export default {
                 "pageSize": 20
             },
             list: [],
-            logo: uni.getStorageSync('site').logo
         }
     }, onLoad(options) {
         this.getList(true)
@@ -56,7 +55,7 @@ export default {
                 console.log("获取历史足迹", res)
                 if (this.cutoff(res.msg)) return;
                 res.data = res.data.map(v => {
-                    v.image = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : '';
+                    v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : uni.getStorageSync('site').logo || '';
                     v.distance = v.distance > 1000 ? ((v.distance / 1000).toFixed(2) - 0) + 'km' : ((v.distance).toFixed(2) - 0) + 'm'
                     return v
                 })
@@ -64,11 +63,6 @@ export default {
                 this.content = this.$refs.List.paging(this.content, res)
             })
         },
-        callPhone(phoneNumber) {
-            uni.makePhoneCall({
-                phoneNumber: phoneNumber + ''
-            })
-        },
         goAtOnce(item) {
             uni.openLocation({
                 latitude: item.latitude - 0,

+ 5 - 0
pages.json

@@ -59,6 +59,11 @@
 		}, {
 			"path": "electricAppliances/index"
 		}]
+	}, {
+		"root": "store",
+		"pages": [{
+			"path": "product/detail"
+		}]
 	}],
 	"preloadRule": {
 		"pages/login/login": {

+ 9 - 3
pages/index/index.vue

@@ -1,6 +1,7 @@
 <template>
 	<view>
-		<index ref="首页" v-show="page == '首页'" @changePage="changePage" />
+		<index ref="首页" v-show="page == '首页'" />
+		<store ref="活动" v-show="page == '活动'" />
 		<my-case ref="案例" v-show="page == '案例'" />
 		<dataBank ref="资料库" v-show="page == '资料库'" />
 		<school ref="商学院" v-show="page == '商学院'" />
@@ -12,6 +13,7 @@
 
 <script>
 import index from './index/index.vue'
+import store from './index/store.vue'
 import myCase from './index/myCase.vue'
 import dataBank from './cloud/dataBank.vue'
 import school from './cloud/school.vue'
@@ -19,7 +21,7 @@ import product from './cloud/product.vue'
 
 import bottomSuspensionFrame from "./modules/bottomSuspensionFrame.vue";
 export default {
-	components: { bottomSuspensionFrame, index, myCase, dataBank, school, product },
+	components: { bottomSuspensionFrame, index, store, myCase, dataBank, school, product },
 	data() {
 		return {
 			swiperItemID: 'index',
@@ -27,6 +29,10 @@ export default {
 		}
 	},
 	onShow() {
+		this.$Http.changePage = function (itemId, page, params) {
+			this.$refs.pages.onClick(itemId, page, false, params)
+		}.bind(this)
+
 		// #ifdef MP-WEIXIN
 		this.updatePageData(this.swiperItemID, this.page)
 		// #endif
@@ -36,7 +42,7 @@ export default {
 			if (this.$refs[this.page].updatePage) this.$refs.pages.onClick(itemId, page)
 		},
 		changePage(itemId, page, params) {
-			this.$refs.pages.onClick(itemId, page, false, params)
+
 		},
 		pageChange(detail) {
 			uni.setNavigationBarTitle({

+ 12 - 14
pages/index/index/index.vue

@@ -10,7 +10,7 @@
         </view>
 
         <slideshow ref="indexTop" />
-        <apps @appsToPage="appsToPage" />
+        <apps />
 
         <view class="shop" v-if="shopDetail.storename">
             <view class="head">
@@ -89,11 +89,6 @@ import contact from "../../../components/contact"
 import apps from "./modules/apps"
 export default {
     components: { contact, apps },
-    props: {
-        changePage: {
-            type: Function
-        }
-    },
     data() {
         return {
             updatePage: true,
@@ -105,6 +100,16 @@ export default {
             getLocationLoading: true,
         }
     },
+    watch: {
+        shopDetail: function (newVal) {
+            if (newVal) {
+                uni.removeStorageSync('shop');
+                uni.setStorageSync('shop', newVal)
+            } else {
+
+            }
+        }
+    },
     methods: {
         init(callBack) {
             Promise.all([this.getLocaT(), this.$refs.indexTop.getBanners(['indexTop']), this.$refs.indexBottom.getBanners(['indexBottom'])]).then(res => {
@@ -112,9 +117,6 @@ export default {
                 this.updatePage = false;
             })
         },
-        appsToPage(id, name, params) {
-            this.$emit("changePage", id, name, params)
-        },
         getLocaT() {
             return new Promise((resolve, reject) => {
                 this.getLocationLoading = true;
@@ -133,17 +135,13 @@ export default {
                         this.showShopOtions = false;
                         console.log("获取最近门店信息", res)
                         if (this.cutoff(res.msg)) return;
+                        res.data.cover = res.data.attinfos.length ? this.getSpecifiedImage(res.data.attinfos[0]) : uni.getStorageSync('site').logo || ''
                         res.data.distance = res.data.distance > 1000 ? ((res.data.distance / 1000).toFixed(2) - 0) + 'km' : ((res.data.distance).toFixed(2) - 0) + 'm'
                         this.shopDetail = res.data;
                     })
                 })
             })
         },
-        callPhone(phoneNumber) {
-            uni.makePhoneCall({
-                phoneNumber: phoneNumber + ''
-            })
-        },
         goAtOnce() {
             uni.openLocation({
                 latitude: this.shopDetail.latitude - 0,

+ 3 - 6
pages/index/index/modules/apps.vue

@@ -15,11 +15,6 @@
 <script>
 export default {
     name: "apps",
-    props: {
-        appsToPage: {
-            type: Function
-        }
-    },
     data() {
         return {
             list: [{
@@ -29,6 +24,8 @@ export default {
             }, {
                 label: "商品",
                 introduce: "总部直通车  千万大返利",
+                itemId: "index",
+                page: "活动",
             }, {
                 label: "图库",
                 introduce: "电器 / 厨卫 / 阳台 / 背景墙 /顶墙",
@@ -77,7 +74,7 @@ export default {
     methods: {
         onClick(item) {
             if (item.itemId) {
-                this.$emit("appsToPage", item.itemId, item.page || item.label, item.params || '')
+                this.$Http.changePage(item.itemId, item.page || item.label, item.params || '')
             } else if (item.path) {
                 uni.navigateTo({
                     url: item.path,

+ 260 - 0
pages/index/index/store.vue

@@ -0,0 +1,260 @@
+<template>
+    <view>
+        <view class="My_search-box">
+            <My_search :value="content.where.condition" @onSearch="onSearch">
+                <view class="cancel" v-if="content.where.condition" hover-class="navigator-hover" @click="onSearch('')">
+                    取消
+                </view>
+                <view v-else style="width: 5px;" />
+            </My_search>
+        </view>
+        <view class="tabs-box" v-if="tabs.length">
+            <v-tabs ref="tabs" v-model="tabsActive" field="remarks" :pills="true" height="24px" pillsBorderRadius="12px"
+                pillsColor="#C30D23" pillsUnColor="#eee" bgColor="none" itemMargin="0 4px 0 0" color="#333333"
+                activeColor="#FFFFFF" :tabs="tabs" @change="changeClass" />
+        </view>
+        <view class="head">
+            <view class="label">
+                精选商品
+            </view>
+            <view class="switch" hover-class="navigator-hover" @click="changeIsnew(content.where.isnew)">
+                <view class="status" :class="content.where.isnew == '' ? 'active' : ''">
+                    全部
+                </view>
+                <view class="status" :class="content.where.isnew == '1' ? 'active' : ''">
+                    新品
+                </view>
+            </view>
+        </view>
+        <My_listbox ref="List" @getlist="getList" :bottomHeight="70" boxBackground="#fff">
+            <view class="products-box">
+                <navigator :url="'/store/product/detail?id=' + item.sa_fadid" class="item" v-for="item in list"
+                    hover-class="navigator-hover" :key="item.sa_fadid">
+                    <u--image :src="item.cover" :width="tovw(172)" :height="tovw(160)" radius="5">
+                        <template v-slot:loading>
+                            <u-loading-icon color="red"></u-loading-icon>
+                        </template>
+                    </u--image>
+                    <view class="text">
+                        <view class="title u-line-1">{{ item.name }}</view>
+                        <view class="price">
+                            ¥<text class="num">
+                                {{ CNY(item.pricetype == '一口价' ? item.price : item.price_deposit, '') }}
+                            </text>元/{{ item.unitname }}
+                        </view>
+                        <view v-if="item.tag" class="tag">{{ item.tag }}</view>
+                    </view>
+                </navigator>
+            </view>
+        </My_listbox>
+    </view>
+</template>
+
+<script>
+export default {
+    components: {},
+    data() {
+        return {
+            updatePage: true,
+            tabs: [],
+            list: [],
+            tabsActive: 0,
+            "content": {
+                "sys_enterpriseid": uni.getStorageSync("shop").sys_enterpriseid || -1,
+                "pageNumber": 1,
+                "pageSize": 20,
+                "where": {
+                    "condition": "",
+                    "isnew": '',
+                    "class": ""
+                }
+            }
+        }
+    },
+    methods: {
+        init(callBack) {
+            callBack()
+            this.updatePage = false;
+            Promise.all([this.getType(), this.getList(true)]).then(res => {
+                callBack()
+                this.updatePage = false;
+            })
+        },
+        getType() {
+            return new Promise((resolve, reject) => {
+                this.getCustomClass("goodstype").then(list => {
+                    console.log("自定义分类地址", list)
+                    this.$refs.List.setHeight()
+                    if (list.length) list.unshift({ value: "", remarks: "全部" })
+                    this.tabs = list;
+                })
+            })
+        },
+        getList(init = false) {
+            return new Promise((resolve, reject) => {
+                if (this.paging(this.content, init)) return resolve();
+                this.$Http.basic({
+                    "id": "20240430094102",
+                    content: this.content
+                }).then(res => {
+                    this.$refs.List.setHeight()
+                    this.$refs.List.RefreshToComplete()
+                    console.log("获取商城列表", res)
+                    resolve();
+                    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 == "sa_fad") || v.attinfos[0]) : uni.getStorageSync("site").logo || ''
+                        return v
+                    })
+                    this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
+                    this.content = this.$refs.List.paging(this.content, res)
+                    this.total = res.total;
+                })
+            })
+        },
+        changeIsnew(isnew) {
+            this.content.where.isnew = isnew == 1 ? "" : 1;
+            this.getList(true);
+        },
+        onSearch(condition) {
+            if (condition == this.content.where.condition) return;
+            this.content.where.condition = condition;
+            this.getList(true);
+        },
+        changeClass(index) {
+            this.tabsActive = index;
+            this.content.where.class = this.tabs[index].value;
+            this.getList(true);
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.My_search-box {
+    background: #fff;
+    width: 100vw;
+    padding: 5px;
+    padding-left: 10px;
+    box-sizing: border-box;
+
+    .cancel {
+        line-height: 30px;
+        margin-left: 10px;
+        padding: 0 10px;
+        font-family: Source Han Sans SC, Source Han Sans SC;
+        font-size: 14px;
+        color: #666666;
+        border-radius: 4px;
+    }
+}
+
+
+.head {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    width: 100vw;
+    height: 48px;
+    padding: 10px;
+    box-sizing: border-box;
+    background: #fff;
+    margin-top: 10px;
+
+    .label {
+        font-family: Source Han Sans SC, Source Han Sans SC;
+        font-weight: bold;
+        font-size: 14px;
+        color: #333333;
+    }
+
+    .switch {
+        display: flex;
+        width: 96px;
+        height: 30px;
+        background: #EEEEEE;
+        margin-right: 10px;
+        border-radius: 15px;
+
+        .status {
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            height: 30px;
+            width: 48px;
+            border-radius: 15px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 14px;
+            color: #666666;
+            background: #EEEEEE;
+        }
+
+        .active {
+            background: #C30D23;
+            color: #fff;
+        }
+    }
+
+}
+
+.products-box {
+    display: flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+    padding: 0 10px;
+    box-sizing: border-box;
+
+    .item {
+        width: 172px;
+        border-radius: 5px;
+        margin-top: 20px;
+
+        .text {
+            padding: 10px;
+            box-sizing: border-box;
+
+            .title {
+                line-height: 20px;
+                font-family: PingFang SC, PingFang SC;
+                font-size: 14px;
+                color: #333333;
+            }
+
+            .price {
+                line-height: 17px;
+                font-family: PingFang SC, PingFang SC;
+                font-size: 12px;
+                color: #E3041F;
+                margin-top: 2px;
+
+                .num {
+                    font-family: PingFang SC, PingFang SC;
+                    font-weight: bold;
+                    font-size: 18px;
+                    color: #E3041F;
+                    margin-right: 2px;
+                }
+            }
+
+            .tag {
+                width: max-content;
+                background: #FFFFFF;
+                border: 1px solid #E3041F;
+                padding: 2px 4px;
+                box-sizing: border-box;
+                font-family: PingFang SC, PingFang SC;
+                font-size: 10px;
+                color: #E3041F;
+                margin-top: 4px;
+            }
+        }
+    }
+}
+
+.tabs-box {
+    width: 100vw;
+    background: #fff;
+    padding: 8px 0 10px 10px;
+    box-sizing: border-box;
+}
+</style>

+ 11 - 7
static/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4131149 */
-  src: url('//at.alicdn.com/t/c/font_4131149_vvqgurcstc.woff2?t=1714112273836') format('woff2'),
-       url('//at.alicdn.com/t/c/font_4131149_vvqgurcstc.woff?t=1714112273836') format('woff'),
-       url('//at.alicdn.com/t/c/font_4131149_vvqgurcstc.ttf?t=1714112273836') format('truetype');
+  src: url('//at.alicdn.com/t/c/font_4131149_s05pnd9g0jk.woff2?t=1715145392579') format('woff2'),
+       url('//at.alicdn.com/t/c/font_4131149_s05pnd9g0jk.woff?t=1715145392579') format('woff'),
+       url('//at.alicdn.com/t/c/font_4131149_s05pnd9g0jk.ttf?t=1715145392579') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-a-biaoqianlanshouyexuanzhong:before {
+  content: "\e606";
+}
+
+.icon-bianji:before {
+  content: "\e6cd";
+}
+
 .icon-a-wodetiaozhuan:before {
   content: "\e647";
 }
@@ -141,10 +149,6 @@
   content: "\e6ac";
 }
 
-.icon-dizhi-hei:before {
-  content: "\e6ae";
-}
-
 .icon-dizhi-hui:before {
   content: "\e6af";
 }

+ 397 - 0
store/product/detail.vue

@@ -0,0 +1,397 @@
+<template>
+    <view>
+        <swiper class="swiper">
+            <swiper-item v-for="item in files" :key="item.attachmentid">
+                <u--image :src="item.cover" :lazy-load="true" width="100vw" :height="tovw(377)"
+                    @click.stop="previewImg(item.url)">
+                    <template v-slot:loading>
+                        <u-loading-icon color="red" />
+                    </template>
+                </u--image>
+            </swiper-item>
+        </swiper>
+        <view class="head">
+            <view class="name u-line-1">{{ detail.name || '--' }}</view>
+            <view class="tag u-line-1">
+                {{ detail.tag }}
+            </view>
+            <view v-if="detail.pricetype == '一口价'" class="price-box">
+                <text class="label">
+                    价格
+                </text>
+                <text class="unit">
+                    ¥
+                </text>
+                <text class="price">
+                    {{ CNY(detail.price, '') }}
+                </text>
+                <text class="unit">
+                    元/{{ detail.unitname }}
+                </text>
+            </view>
+            <block v-else>
+                <view class="price-box">
+                    <text class="label">
+                        总部返利价
+                    </text>
+                    <text class="unit">
+                        ¥
+                    </text>
+                    <text class="price">
+                        {{ CNY(detail.price_rebate, '') }}
+                    </text>
+                    <text class="unit">
+                        元/{{ detail.unitname }}
+                    </text>
+                </view>
+
+                <view class="price-box">
+                    <text class="label">
+                        门店价
+                    </text>
+                    <text class="unit">
+                        ¥
+                    </text>
+                    <text class="price">
+                        {{ CNY(detail.price_store, '') }}
+                    </text>
+                    <text class="unit">
+                        元/{{ detail.unitname }}
+                    </text>
+                    <text class="delete">
+                        原价:{{ CNY(detail.price_original) }} 元/{{ detail.unitname }}
+                    </text>
+                </view>
+
+                <view class="price-box">
+                    <text class="label">
+                        定金
+                    </text>
+                    <text class="unit">
+                        ¥
+                    </text>
+                    <text class="price">
+                        {{ CNY(detail.price_deposit, '') }}
+                    </text>
+                    <text class="unit">
+                        元/{{ detail.unitname }}
+                    </text>
+                </view>
+            </block>
+            <view style="height: 10px;" />
+            <view class="row">
+                型号:{{ detail.model || '--' }}
+            </view>
+            <view v-if="detail.subtitle" class="row">
+                {{ detail.subtitle }}
+            </view>
+            <view class="collect" hover-class="navigator-hover"
+                @click="collectLoading ? '' : handleCollect(detail.iscollect)">
+                <u-loading-icon v-if="collectLoading" size="20" />
+                <block v-else>
+                    <text v-if="detail.iscollect == 0" class="iconfont icon-weishoucang" />
+                    <text v-else class="iconfont icon-yishoucang" style="color: #FFC300;" />
+                    收藏
+                </block>
+            </view>
+        </view>
+
+        <storeInfo marTop="10" />
+
+        <view class="division">
+            <view class="line" />
+            详情
+            <view class="line" />
+        </view>
+        <view v-if="detail.content" style="background-color: #fff;">
+            <u-parse :content="detail.content" />
+        </view>
+
+        <u--image src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202405081715135815557B4db50f9.webp"
+            :lazy-load="true" width="100vw" height="none" mode="widthFix"
+            @click.stop="previewImg('https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202405081715135815557B4db50f9.webp')">
+            <template v-slot:loading>
+                <u-loading-icon color="red" />
+            </template>
+        </u--image>
+        <view style="width: 100vw;height: 75px;background-color: #fff;" />
+
+        <view class="footer">
+            <view class="fun-but" @click="toHome" hover-class="navigator-hover">
+                <view class="iconfont icon-a-biaoqianlanshouyexuanzhong" />
+                <view class="text">
+                    首页
+                </view>
+            </view>
+            <view class="fun-but" hover-class="navigator-hover">
+                <contact>
+                    <view class="iconfont icon-kefu" />
+                    <view class="text">
+                        咨询
+                    </view>
+                </contact>
+            </view>
+            <view class="fun-but" v-if="phoneNumber" hover-class="navigator-hover" @click="callPhone(phoneNumber)">
+                <view class="iconfont icon-dianhua" />
+                <view class="text">
+                    致电
+                </view>
+            </view>
+            <navigator class="place-an-order" url="" hover-class="navigator-hover">
+                预约购买
+            </navigator>
+        </view>
+    </view>
+</template>
+
+<script>
+import { viewImage, formattedFiles } from "../../utils/settleFiles"
+import contact from "../../components/contact"
+
+export default {
+    components: { contact },
+    data() {
+        return {
+            detail: {
+                sa_fadid: 0
+            },
+            files: [],
+            collectLoading: false,
+            phoneNumber: uni.getStorageSync("shop").phonenumber || ''
+        }
+    },
+    onLoad(options) {
+        this.detail.sa_fadid = options.id;
+        this.getDetail()
+    },
+    methods: {
+        toHome() {
+            if (this.$Http.changePage) {
+                this.$Http.changePage("index", '首页')
+                uni.navigateBack();
+            } else {
+                uni.redirectTo({
+                    url: '/pages/index/index',
+                })
+            }
+        },
+        getDetail() {
+            this.$Http.basic({
+                "id": "20240428154202",
+                "content": {
+                    "sa_fadid": this.detail.sa_fadid
+                }
+            }).then(res => {
+                console.log("商品详情", res)
+                if (this.cutoff(res.msg)) return;
+                this.files = formattedFiles(res.data.attinfos_pic.map(v => v.attinfos[0])).map(v => {
+                    if (v.fileType == 'image') v.cover = this.getSpecifiedImage(v, 'compressed')
+                    return v
+                })
+                this.detail = res.data;
+                uni.setNavigationBarTitle({
+                    title: res.data.name || '商品详情'
+                });
+            })
+
+        },
+        previewImg(url) {
+            viewImage(url)
+        },
+        handleCollect(iscollect) {
+            this.collectLoading = true;
+            this.$Http.basic({
+                "id": 20240416133702,
+                "content": {
+                    "ownertable": "sa_fad",
+                    "ownerid": this.detail.sa_fadid,
+                    "type": 1
+                },
+            }).then(res => {
+                console.log("收藏", res)
+                this.collectLoading = false;
+                if (this.cutoff(res.msg)) return;
+                this.detail.iscollect = iscollect ? 0 : 1
+            })
+        },
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.swiper {
+    width: 100vw;
+    height: 377px;
+}
+
+.head {
+    position: relative;
+    background: #fff;
+    padding: 10px;
+    box-sizing: border-box;
+
+    .name {
+        width: 280px;
+        height: 24px;
+        line-height: 24px;
+        font-family: Source Han Sans SC, Source Han Sans SC;
+        font-weight: bold;
+        font-size: 16px;
+        color: #333333;
+    }
+
+    .tag {
+        width: max-content;
+        background: #FFFFFF;
+        border: 1px solid #E3041F;
+        padding: 2px 4px;
+        box-sizing: border-box;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 10px;
+        color: #E3041F;
+        margin-top: 5px;
+        max-width: 355px;
+    }
+
+    .price-box {
+        font-family: Source Han Sans SC, Source Han Sans SC;
+
+        .label {
+            color: #333;
+            font-size: 12px;
+        }
+
+        .unit {
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 12px;
+            color: #E3041F;
+            margin-left: 4px;
+        }
+
+        .price {
+            color: #E3041F;
+            font-size: 18px;
+            font-weight: bold;
+        }
+
+        .delete {
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 12px;
+            color: #333333;
+            text-decoration-line: line-through;
+            margin-left: 10px;
+        }
+    }
+
+    .price-box:last-child {
+        margin-bottom: 10px;
+        background: red;
+    }
+
+    .row {
+        line-height: 17px;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 12px;
+        color: #999999;
+        margin-bottom: 5px;
+    }
+
+    .collect {
+        position: absolute;
+        right: 0;
+        top: 10px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 66px;
+        height: 24px;
+        border-radius: 12px 0px 0px 12px;
+        border: 1px solid #CCCCCC;
+
+        .iconfont {
+            font-size: 14px;
+            margin-right: 4px;
+        }
+
+        font-family: Source Han Sans SC,
+        Source Han Sans SC;
+        font-size: 12px;
+        color: #666666;
+    }
+}
+
+.division {
+    width: 375px;
+    height: 40px;
+    background: #FFFFFF;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+
+    font-family: Source Han Sans SC, Source Han Sans SC;
+    font-weight: bold;
+    font-size: 14px;
+    color: #333333;
+    margin-top: 10px;
+
+    .line {
+        width: 20px;
+        height: 1px;
+        background: #333333;
+        margin: 0 4px;
+    }
+}
+
+.footer {
+    position: fixed;
+    display: flex;
+    width: 100vw;
+    height: 65px;
+    background: #FFFFFF;
+    box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
+    bottom: 0;
+    left: 0;
+    padding: 10px;
+    padding-top: 5px;
+    box-sizing: border-box;
+
+    .fun-but {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        padding-top: 8px;
+        width: 50px;
+        border-radius: 5px;
+        flex-shrink: 0;
+
+        .iconfont {
+            font-size: 16px;
+            color: #333333;
+            line-height: 20px !important;
+        }
+
+        .text {
+            line-height: 14px !important;
+            font-family: PingFang SC, PingFang SC;
+            font-size: 10px;
+            color: #333333;
+            margin-top: 4px;
+        }
+    }
+
+    .place-an-order {
+        flex: 1;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        height: 45px;
+        background: #C30D23;
+        border-radius: 5px;
+        margin-left: 10px;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: bold;
+        font-size: 14px;
+        color: #FFFFFF;
+    }
+}
+</style>

+ 17 - 7
utils/tool.js

@@ -123,7 +123,6 @@ function mount() {
         let v = item.subfiles.find(v => v.type == type);
         return v ? v.url : item.url;
     }
-
     Vue.prototype.formatTime = (date = new Date(), j1 = '-', j2 = ':') => {
         const year = date.getFullYear()
         const month = date.getMonth() + 1
@@ -139,7 +138,6 @@ function mount() {
 
         return `${[year, month, day].map(formatNumber).join(j1)} ${[hour, minute, second].map(formatNumber).join(j2)}`
     }
-
     Vue.prototype.getCustomClass = (typename) => {
         return new Promise((resolve, reject) => {
             Vue.prototype.$Http.basic({
@@ -155,16 +153,28 @@ function mount() {
             })
         })
     }
-
-
-    Vue.prototype.CNY = (sum, precision = 2) => {
+    Vue.prototype.CNY = (sum, symbol = '¥', strict = true, precision = 2) => {
         const currency = require("./currency.js");
-        return currency(sum, {
-            symbol: "¥",
+        let num = currency(sum, {
+            symbol,
             precision
         }).format();
+        if (strict) {
+            let decimals = num.split(".");
+            decimals[1] = ('0.' + decimals[1] - 0 + '').substring(2)
+            num = decimals[1] ? decimals.join(".") : decimals[0]
+        }
+        return num
     }
+    Vue.prototype.callPhone = phoneNumber => {
+        uni.makePhoneCall({
+            phoneNumber: phoneNumber + '',
+            complete: res => {
+                console.log('makePhoneCall', res)
+            }
+        })
 
+    }
 }
 
 module.exports = {