绿满眶商城微信小程序-uniapp
peng
2025-07-08 1172c0ff85963a0f3b8fe5212082462b9ce0b1bc
商品发布
1个文件已修改
7个文件已添加
527 ■■■■■ 已修改文件
api/supplier.js 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/supplier/publish-goods/chooseCategery.vue 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/supplier/publish-goods/publishGoods.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uni_modules/uni-steps/changelog.md 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uni_modules/uni-steps/components/uni-steps/uni-steps.vue 280 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uni_modules/uni-steps/package.json 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uni_modules/uni-steps/readme.md 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/supplier.js
New file
@@ -0,0 +1,21 @@
/**
 * 小程序商户端API
 */
import { http, Method } from "@/utils/request.js";
import api from "@/config/api.js";
/**
 * 小程序商户端获取店铺经营的分类
 *
 * @param params
 */
 export function getMyActivityList() {
  return http.request({
    url: "/lmk/supplier/allCategery",
    method: Method.GET,
    needToken: true,
  });
}
pages.json
@@ -1498,6 +1498,16 @@
                }
            }]
        }
        // {
        //     "root": "pages/supplier/publish-goods",
        //     "pages": [{
        //         "path": "publishGoods",
        //         "style": {
        //             "navigationBarTitleText": "商品发布"
        //             // "navigationStyle": "custom"
        //         }
        //     }]
        // }
        // ,
        // {
        //     "root": "pages/commodity-square",
pages/supplier/publish-goods/chooseCategery.vue
New file
@@ -0,0 +1,61 @@
<template>
    <view class="container">
        <scroll-view scroll-y="true" style="height: 70vh">
            <view class="categeryContainer">
                <view class="categeryItem" v-for="item in categeryList" :key="item.id" @click="chooseCategery(item.id,item.name)">
                    <view class="cateGeryName" :class="{chooseCategeryStyle:chooseCategeryId==item.id}">
                        {{item.name}}
                    </view>
                </view>
            </view>
        </scroll-view>
        <view class="">您当前选择的商品类别是:{{categeryName}}</view>
    </view>
</template>
<script>
    import {
        getMyActivityList
    } from '@/api/merchant.js'
    export default {
        data() {
            return {
                categeryName:'',
                chooseCategeryId: '',
                categeryList: [],
            }
        },
        methods:{
            chooseCategery(id,name){
                this.chooseCategeryId =id
                this.categeryName = name
            }
        },
        async mounted() {
            const categeryList = await getMyActivityList();
            this.categeryList = categeryList.data.result;
        }
    }
</script>
<style>
    .categeryContainer {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }
    .categeryItem {
        height: 120rpx;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .chooseCategeryStyle{
        color: #e06c75;
        font-weight: bold;
        font-size: 1.2em;
    }
</style>
pages/supplier/publish-goods/publishGoods.vue
New file
@@ -0,0 +1,37 @@
<template>
    <view class="container">
        <uni-steps :options="publishSteps" :active="currentStep" active-color='#f31947'></uni-steps>
        <choose-categery v-if="currentStep===0"></choose-categery>
    </view>
</template>
<script>
    import chooseCategery from './chooseCategery.vue';
    export default {
        components: { chooseCategery },
        data() {
            return {
                currentStep:0,
                publishSteps: [{
                        title: ' 选择商品品类'
                    },
                    {
                        title: ' 填写商品详情'
                    },
                    {
                        title: ' 商品发布成功'
                    }
                ],
            }
        }
    }
</script>
<style>
    .container {
        width: 750rpx;
        padding: 32rpx;
        box-sizing: border-box;
    }
</style>
uni_modules/uni-steps/changelog.md
New file
@@ -0,0 +1,18 @@
## 1.1.2(2024-03-28)
- 修复 uni-steps为竖排列时,文本长度过长引起点错乱的bug
## 1.1.1(2021-11-22)
- 修复 vue3中某些scss变量无法找到的问题
## 1.1.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-steps](https://uniapp.dcloud.io/component/uniui/uni-steps)
## 1.0.8(2021-05-12)
- 新增 项目示例地址
## 1.0.7(2021-05-06)
- 修复 uni-steps 横向布局时,多行文字高度不合理的 bug
## 1.0.6(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.5(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件
## 1.0.4(2021-02-05)
- 调整为uni_modules目录规范
uni_modules/uni-steps/components/uni-steps/uni-steps.vue
New file
@@ -0,0 +1,280 @@
<template>
    <view class="uni-steps">
        <view :class="[direction==='column'?'uni-steps__column':'uni-steps__row']">
            <view :class="[direction==='column'?'uni-steps__column-text-container':'uni-steps__row-text-container']">
                <view v-for="(item,index) in options" :key="index"
                    :class="[direction==='column'?'uni-steps__column-text':'uni-steps__row-text']">
                    <text :style="{color:index === active?activeColor:deactiveColor}"
                        :class="[direction==='column'?'uni-steps__column-title':'uni-steps__row-title']">{{item.title}}</text>
                    <text :style="{color: deactiveColor}"
                        :class="[direction==='column'?'uni-steps__column-desc':'uni-steps__row-desc']">{{item.desc}}</text>
                </view>
            </view>
            <view :class="[direction==='column'?'uni-steps__column-container':'uni-steps__row-container']">
                <view :class="[direction==='column'?'uni-steps__column-line-item':'uni-steps__row-line-item']"
                    v-for="(item,index) in options" :key="index" :style="{height: direction === 'column'?heightArr[index]+'px':'14px'}">
                    <view
                        :class="[direction==='column'?'uni-steps__column-line':'uni-steps__row-line',direction==='column'?'uni-steps__column-line--before':'uni-steps__row-line--before']"
                        :style="{backgroundColor:index<=active&&index!==0?activeColor:index===0?'transparent':deactiveColor}">
                    </view>
                    <view :class="[direction==='column'?'uni-steps__column-check':'uni-steps__row-check']"
                        v-if="index === active">
                        <uni-icons :color="activeColor" :type="activeIcon" size="14" />
                    </view>
                    <view v-else :class="[direction==='column'?'uni-steps__column-circle':'uni-steps__row-circle']"
                        :style="{backgroundColor:index<active?activeColor:deactiveColor}" />
                    <view
                        :class="[direction==='column'?'uni-steps__column-line':'uni-steps__row-line',direction==='column'?'uni-steps__column-line--after':'uni-steps__row-line--after']"
                        :style="{backgroundColor:index<active&&index!==options.length-1?activeColor:index===options.length-1?'transparent':deactiveColor}" />
                </view>
            </view>
        </view>
    </view>
</template>
<script>
    /**
     * Steps 步骤条
     * @description 评分组件
     * @tutorial https://ext.dcloud.net.cn/plugin?id=34
     * @property {Number} active 当前步骤
     * @property {String} direction = [row|column] 当前步骤
     *     @value row 横向
     *     @value column 纵向
     * @property {String} activeColor 选中状态的颜色
     * @property {Array} options 数据源,格式为:[{title:'xxx',desc:'xxx'},{title:'xxx',desc:'xxx'}]
     */
    export default {
        name: 'UniSteps',
        props: {
            direction: {
                // 排列方向 row column
                type: String,
                default: 'row'
            },
            activeColor: {
                // 激活状态颜色
                type: String,
                default: '#2979FF'
            },
            deactiveColor: {
                // 未激活状态颜色
                type: String,
                default: '#B7BDC6'
            },
            active: {
                // 当前步骤
                type: Number,
                default: 0
            },
            activeIcon: {
                // 当前步骤
                type: String,
                default: 'checkbox-filled'
            },
            options: {
                type: Array,
                default () {
                    return []
                }
            } // 数据
        },
        data() {
            return {
                heightArr: [],
            }
        },
        mounted() {
            //根据内容设置步骤条的长度
            if (this.direction === 'column') {
                let that = this;
                //只能用类选择器,用id选择器所获取的元素信息不准确
                uni.createSelectorQuery().in(this).selectAll('.uni-steps__column-text').boundingClientRect(data => {
                    that.heightArr = data.map(item => item.height + 1);
                }).exec()
            }
        },
    }
</script>
<style lang="scss">
    $uni-primary: #2979ff !default;
    $uni-border-color: #EDEDED;
    .uni-steps {
        /* #ifndef APP-NVUE */
        display: flex;
        width: 100%;
        /* #endif */
        /* #ifdef APP-NVUE */
        flex: 1;
        /* #endif */
        flex-direction: column;
    }
    .uni-steps__row {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
    }
    .uni-steps__column {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row-reverse;
    }
    .uni-steps__row-text-container {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        align-items: flex-end;
        margin-bottom: 8px;
    }
    .uni-steps__column-text-container {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
        flex: 1;
    }
    .uni-steps__row-text {
        /* #ifndef APP-NVUE */
        display: inline-flex;
        /* #endif */
        flex: 1;
        flex-direction: column;
    }
    .uni-steps__column-text {
        padding: 6px 0px;
        border-bottom-style: solid;
        border-bottom-width: 1px;
        border-bottom-color: $uni-border-color;
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
    }
    .uni-steps__row-title {
        font-size: 14px;
        line-height: 16px;
        text-align: center;
    }
    .uni-steps__column-title {
        font-size: 14px;
        text-align: left;
        line-height: 18px;
    }
    .uni-steps__row-desc {
        font-size: 12px;
        line-height: 14px;
        text-align: center;
    }
    .uni-steps__column-desc {
        font-size: 12px;
        text-align: left;
        line-height: 18px;
    }
    .uni-steps__row-container {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
    }
    .uni-steps__column-container {
        /* #ifndef APP-NVUE */
        display: inline-flex;
        /* #endif */
        width: 30px;
        flex-direction: column;
    }
    .uni-steps__row-line-item {
        /* #ifndef APP-NVUE */
        display: inline-flex;
        /* #endif */
        flex-direction: row;
        flex: 1;
        height: 14px;
        line-height: 14px;
        align-items: center;
        justify-content: center;
    }
    .uni-steps__column-line-item {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .uni-steps__row-line {
        flex: 1;
        height: 1px;
        background-color: #B7BDC6;
    }
    .uni-steps__column-line {
        width: 1px;
        background-color: #B7BDC6;
    }
    .uni-steps__row-line--after {
        transform: translateX(1px);
    }
    .uni-steps__column-line--after {
        flex: 1;
        transform: translate(0px, 1px);
    }
    .uni-steps__row-line--before {
        transform: translateX(-1px);
    }
    .uni-steps__column-line--before {
        height: 6px;
        transform: translate(0px, -13px);
    }
    .uni-steps__row-circle {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background-color: #B7BDC6;
        margin: 0px 3px;
    }
    .uni-steps__column-circle {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background-color: #B7BDC6;
        margin: 4px 0px 5px 0px;
    }
    .uni-steps__row-check {
        margin: 0px 6px;
    }
    .uni-steps__column-check {
        height: 14px;
        line-height: 14px;
        margin: 2px 0px;
    }
</style>
uni_modules/uni-steps/package.json
New file
@@ -0,0 +1,87 @@
{
  "id": "uni-steps",
  "displayName": "uni-steps 步骤条",
  "version": "1.1.2",
  "description": "步骤条组件,提供横向和纵向两种布局格式。",
  "keywords": [
    "uni-ui",
    "uniui",
    "步骤条",
    "时间轴"
],
  "repository": "https://github.com/dcloudio/uni-ui",
  "engines": {
    "HBuilderX": ""
  },
  "directories": {
    "example": "../../temps/example_temps"
  },
"dcloudext": {
    "sale": {
      "regular": {
        "price": "0.00"
      },
      "sourcecode": {
        "price": "0.00"
      }
    },
    "contact": {
      "qq": ""
    },
    "declaration": {
      "ads": "无",
      "data": "无",
      "permissions": "无"
    },
    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
    "type": "component-vue"
  },
  "uni_modules": {
    "dependencies": [
            "uni-scss",
            "uni-icons"
        ],
    "encrypt": [],
    "platforms": {
      "cloud": {
        "tcb": "y",
        "aliyun": "y",
        "alipay": "n"
      },
      "client": {
        "App": {
          "app-vue": "y",
          "app-nvue": "y"
        },
        "H5-mobile": {
          "Safari": "y",
          "Android Browser": "y",
          "微信浏览器(Android)": "y",
          "QQ浏览器(Android)": "y"
        },
        "H5-pc": {
          "Chrome": "y",
          "IE": "y",
          "Edge": "y",
          "Firefox": "y",
          "Safari": "y"
        },
        "小程序": {
          "微信": "y",
          "阿里": "y",
          "百度": "y",
          "字节跳动": "y",
          "QQ": "y"
        },
        "快应用": {
          "华为": "u",
          "联盟": "u"
        },
        "Vue": {
            "vue2": "y",
            "vue3": "y"
        }
      }
    }
  }
}
uni_modules/uni-steps/readme.md
New file
@@ -0,0 +1,13 @@
## Steps 步骤条
> **组件名:uni-steps**
> 代码块: `uSteps`
步骤条,常用于显示进度
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-steps)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839