From 536a25aba6acdd5d0e637ae8e488e0de63a3fe48 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 28 五月 2025 10:56:32 +0800 Subject: [PATCH] 合并代码 --- pages/tabbar/user/utils/tool.vue | 9 pages.json | 15 + pages/goods-manager/goodsList/goodsList.vue | 288 ++++++++++++++++++++++++++++ pages/goods-manager/addGoods/addGoods.vue | 167 ++++++++++++++++ pages/goods-manager/goodsList/goodsList.scss | 120 ++++++++++++ 5 files changed, 597 insertions(+), 2 deletions(-) diff --git a/pages.json b/pages.json index 0cecfe0..d7c60c8 100644 --- a/pages.json +++ b/pages.json @@ -214,6 +214,21 @@ "u-search": "view" } } + }, + { + "path" : "pages/goods-manager/goodsList/goodsList", + "style" : + { + "enablePullDownRefresh" : true, + "navigationBarTitleText" : "鍟嗗搧鍒楄〃" + } + }, + { + "path" : "pages/goods-manager/addGoods/addGoods", + "style" : + { + "navigationBarTitleText" : "" + } } diff --git a/pages/goods-manager/addGoods/addGoods.vue b/pages/goods-manager/addGoods/addGoods.vue new file mode 100644 index 0000000..1c82a58 --- /dev/null +++ b/pages/goods-manager/addGoods/addGoods.vue @@ -0,0 +1,167 @@ +<template> + <view class="add-goods"> + <div class="uForm"> + <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> + + <u-form-item label="鍟嗗搧鍒嗙被" label-width="130" prop=""> + <div @click="showPicker"> + {{ form.___path || '璇烽�夋嫨鎵�鍦ㄥ湴鍖�' }} + </div> + </u-form-item> + + <u-form-item class="border" label="鍟嗗搧鍚嶇О" label-width="130" prop="name"> + <u-input v-model="form.name" clearable placeholder="璇疯緭鍏ュ晢鍝佸悕绉�" /> + </u-form-item> + + <u-form-item label="鍟嗗搧浠锋牸" label-width="130" prop="mobile"> + <u-input v-model="form.mobile" type="number" maxlength="11" placeholder="璇疯緭鍏ュ晢鍝佷环鏍�" /> + </u-form-item> + <u-form-item class="detailgoods" label="璇︾粏鍦板潃" label-width="130" prop="detail"> + <u-input type="textarea" v-model="form.detail" maxlength="100" height="150" placeholder="琛楅亾妤肩墝鍙风瓑" /> + </u-form-item> + <u-form-item label="鍟嗗搧鍗栫偣" label-width="130"> + <u-input type="textarea" v-model="form.alias" placeholder="璇疯緭鍏ュ晢鍝佸崠鐐�" /> + </u-form-item> + + <u-form-item label="鍟嗗搧鍝佺墝" label-width="130" prop=""> + <div @click="showPicker"> + {{ form.___path || '璇烽�夋嫨鎵�鍦ㄥ湴鍖�' }} + </div> + </u-form-item> + + <u-form-item label="璁¢噺鍗曚綅" label-width="130" prop="___path"> + <div @click="showPicker"> + {{ form.___path || '璇烽�夋嫨鎵�鍦ㄥ湴鍖�' }} + </div> + </u-form-item> + + + <view class="opt-view"> + <view class="img-title">涓婁紶鍥剧墖锛堟渶澶�5寮狅級</view> + <view class="images-view"> + <u-upload :header="{ accessToken: storage.getAccessToken() }" :action="action" width="150" + @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload> + </view> + </view> + + <div class="saveBtn" @click="save">淇濆瓨</div> + </u-form> + + <m-city :provinceData="list" headTitle="鍖哄煙閫夋嫨" ref="cityPicker" @funcValue="getpickerParentValue" + pickerSize="4"> + </m-city> + + <uniMap v-if="mapFlag" @close="closeMap" @callback="callBackgoods" /> + </div> + </view> +</template> + +<script> +export default { + data() { + return { + form: {} + } + }, + methods: { + //鍥剧墖涓婁紶 + onUploaded(lists) { + let images = []; + + lists.forEach((item) => { + images.push(item.response.result); + }); + this.form.images = images; + }, + }, + + onLoad(option) { + uni.showLoading({ + title: "鍔犺浇涓�", + }); + this.routerVal = option; + console.log(option); + + if (option.id) { + getGoodsDetail(option.id).then((res) => { + const params = res.data.result; + params.___path = params.consigneegoodsPath; + this.$set(this, "form", params); + + if (this.$store.state.isShowToast) { uni.hideLoading() }; + }); + } + uni.hideLoading(); + }, +} +</script> + +<style scoped lang="scss"> +.detailgoods { + /deep/ .u-form-item--left { + display: flex; + align-items: flex-start; + } +} + +.saveBtn, +.selectgoods { + height: 70rpx; + + line-height: 70rpx; + text-align: center; + font-size: 30rpx; + background: $aider-light-color; + color: #fff; + width: 70%; + margin: 40rpx auto 0 auto; + border-radius: 20rpx; +} + +.selectgoods { + margin-top: 40rpx; + background: #fff; + + color: $aider-light-color; + border: 2rpx solid $aider-light-color; +} + +.uForm { + width: 94%; + overflow: hidden; + left: 3%; + position: relative; + top: 2%; + background: #fff; + border-radius: 20rpx; + padding: 0 0 40rpx 0; +} + +.add-goods { + width: 100%; + padding-top: 3%; + + /deep/ .u-form-item { + background-color: #fff; + padding: 24rpx 30rpx; + } + + .u-btn { + margin: 30rpx 30rpx 0 30rpx; + background-color: $main-color; + } + + /deep/.u-checkbox { + margin: 30rpx 30rpx 0 30rpx; + + .u-label-class.u-checkbox__label { + color: $font-color-light; + font-size: $font-sm; + } + } +} + +/deep/ .u-checkbox__label { + font-size: 28rpx; +} +</style> diff --git a/pages/goods-manager/goodsList/goodsList.scss b/pages/goods-manager/goodsList/goodsList.scss new file mode 100644 index 0000000..3f5fca1 --- /dev/null +++ b/pages/goods-manager/goodsList/goodsList.scss @@ -0,0 +1,120 @@ + +.uni-flex { + display: flex; +} + +.uni-flex-row { + @extend .uni-flex; + flex-direction: row; + box-sizing: border-box; +} + +.uni-flex-column { + @extend .uni-flex; + flex-direction: column; +} + +.uni-color-gary { + color: #3b4144; +} + +/* 鏍囬 */ +.uni-title { + display: flex; + margin-bottom: $uni-spacing-col-base; + font-size: $uni-font-size-lg; + font-weight: bold; + color: #3b4144; +} + +.uni-title-sub { + display: flex; + // margin-bottom: $uni-spacing-col-base; + font-size: $uni-font-size-base; + font-weight: 500; + color: #3b4144; +} + +/* 鎻忚堪 棰濆鏂囨湰 */ +.uni-note { + margin-top: 10px; + color: #999; + font-size: $uni-font-size-sm; +} + +/* 鍒楄〃鍐呭 */ +.uni-list-box { + @extend .uni-flex-row; + flex: 1; + margin-top: 10px; +} + +/* 鐣ョ缉鍥� */ +.uni-thumb { + flex-shrink: 0; + margin-right: $uni-spacing-row-base; + width: 125px; + height: 75px; + border-radius: $uni-border-radius-lg; + overflow: hidden; + border: 1px #f5f5f5 solid; + image { + width: 100%; + height: 100%; + } +} + +.uni-media-box { + @extend .uni-flex-row; + // margin-bottom: $uni-spacing-col-base; + border-radius: $uni-border-radius-lg; + overflow: hidden; + .uni-thumb { + margin: 0; + margin-left: 4px; + flex-shrink: 1; + width: 33%; + border-radius:0; + &:first-child { + margin: 0; + } + } +} + +/* 鍐呭 */ +.uni-content { + @extend .uni-flex-column; + justify-content: space-between; +} + +/* 鍒楄〃footer */ +.uni-footer { + @extend .uni-flex-row; + justify-content: space-between; + margin-top: $uni-spacing-col-lg; +} +.uni-footer-text { + font-size: $uni-font-size-sm; + color: $uni-text-color-grey; + margin-left: 5px; +} + +/* 鏍囩 */ + +.uni-tag { + flex-shrink: 0; + padding: 0 5px; + border: 1px $uni-border-color solid; + margin-right: $uni-spacing-row-sm; + border-radius: $uni-border-radius-base; + background: $uni-bg-color-grey; + color: $uni-text-color; + font-size: $uni-font-size-sm; +} + +/* 閾炬帴 */ +.uni-link { + margin-left: 10px; + color: $uni-text-color; + text-decoration: underline; +} \ No newline at end of file diff --git a/pages/goods-manager/goodsList/goodsList.vue b/pages/goods-manager/goodsList/goodsList.vue new file mode 100644 index 0000000..254202a --- /dev/null +++ b/pages/goods-manager/goodsList/goodsList.vue @@ -0,0 +1,288 @@ +<template> + <view class="list"> + <view class='uni-list--waterfall'> + <view class="uni-list "> + <!-- 閫氳繃 uni-list--waterfall 绫诲喅瀹氶〉闈㈠竷灞�鏂瑰悜 --> + <!-- to 灞炴�ф惡甯﹀弬鏁拌烦杞鎯呴〉闈紝褰撳墠鍙负鍙傝�� --> + <view :border="!formData.waterfall" class="uni-list-item--waterfall" title="鑷畾涔夊晢鍝佸垪琛�" + v-for="item in data" :key="item.id" @click="addGoods(item.id)"> + <!-- 閫氳繃header鎻掓Ы瀹氫箟鍒楄〃宸︿晶鍥剧墖 --> + <template v-slot:header> + <view class="uni-thumb shop-picture" :class="{ 'shop-picture-column': formData.waterfall }"> + <image :src="item.goods_thumb" mode="aspectFill"></image> + </view> + </template> + <template v-slot:body> + <view class="shop"> + <view> + <view class="uni-title"> + <text class="uni-ellipsis-2">{{ item.name }}</text> + </view> + <!-- <view> + <text class="uni-tag hot-tag">{{ item.goods_tip }}</text> + <text v-for="tag in item.tag" :key="tag" class="uni-tag">{{ tag }}</text> + </view> --> + </view> + <view> + <view class="shop-price"> + <text>楼</text> + <text class="shop-price-text">{{ item.goods_price }}</text> + <text>.00</text> + </view> + <view class="uni-flex-row"> + <view class="uni-note">{{ item.comment_count||0 }}鏉¤瘎璁� 鏈堥攢閲� {{ + item.month_sell_count||0 }} + </view> + <view class="uni-note ellipsis"> + <text class="uni-link">涓婃灦</text> + + <text class="uni-link" style="color:red;">鍒犻櫎</text> + </view> + </view> + </view> + </view> + </template> + <!-- 閫氳繃body鎻掓Ы瀹氫箟鍟嗗搧甯冨眬 --> + + </view> + </view> + </view> + + <button type="default" class="btn" @click="addGoods('')"> + <u-icon name="plus-circle"></u-icon> + 娣诲姞鍟嗗搧 + </button> + <!-- 閫氳繃 loadMore 缁勪欢瀹炵幇涓婃媺鍔犺浇鏁堟灉锛屽闇�鑷畾涔夋樉绀哄唴瀹癸紝鍙弬鑰冿細https://ext.dcloud.net.cn/plugin?id=29 --> + <uni-load-more v-if="loading || formData.status === 'noMore'" :status="formData.status" /> + + </view> +</template> + +<script> +export default { + components: {}, + data() { + return { + formData: { + waterfall: false, // 甯冨眬鏂瑰悜鍒囨崲 + status: 'loading', // 鍔犺浇鐘舵�� + }, + data: [ + { + "id": 122, + "goods_thumb": "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/83df593e6ba448ddbe6685d928e6fa65.jpg", + "name": "銆愮垎娆俱�慉pple iPhone 11 (A2223) 64GB 娣辩┖鐏拌壊 绉诲姩鑱旈�氱數淇�4G鎵嬫満", + "goods_price": "699.00", + "goods_tip": "鐑崠涓�", + "tag": [ + "鐑崠涓�", + ] + }, + { + "id": 123, + "goods_thumb": "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/83df593e6ba448ddbe6685d928e6fa65.jpg", + "name": "銆愮垎娆俱�慉pple iPhone 11 (A2223) 64GB 娣辩┖鐏拌壊 绉诲姩鑱旈�氱數淇�4G鎵嬫満", + "goods_price": "699.00", + "goods_tip": "鐑崠涓�", + "tag": [ + "鐑崠涓�", + ] + } + ], + formData: { + status: 'loading', // 鍔犺浇鐘舵�� + }, + tipShow: false // 鏄惁鏄剧ず椤堕儴鎻愮ず妗� + }; + }, + onLoad() { }, + methods: { + load(data, ended) { + if (ended) { + this.formData.status = 'noMore' + } + }, + addGoods(id) { + console.log("addGoods:" + id); + + uni.navigateTo({ + url: `/pages/goods-manager/addGoods/addGoods${id ? "?id=" + id : ""}`, + }); + } + + }, + /** + * 涓嬫媺鍒锋柊鍥炶皟鍑芥暟 + */ + onPullDownRefresh() { + this.formData.status = 'more' + + }, + /** + * 涓婃媺鍔犺浇鍥炶皟鍑芥暟 + */ + onReachBottom() { + + } +}; +</script> + + +<style lang="scss" scoped> +@import './goodsList.scss'; + +page { + display: flex; + flex-direction: column; + box-sizing: border-box; + background-color: #efeff4; + min-height: 100%; + height: auto; +} + +.tips { + color: #67c23a; + font-size: 14px; + line-height: 40px; + text-align: center; + background-color: #f0f9eb; + height: 0; + opacity: 0; + transform: translateY(-100%); + transition: all 0.3s; +} + +.tips-ani { + transform: translateY(0); + height: 40px; + opacity: 1; +} + +.shop { + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.shop-picture { + width: 110px; + height: 110px; +} + +.shop-picture-column { + width: 100%; + height: 170px; + margin-bottom: 10px; +} + +.shop-price { + margin-top: 5px; + font-size: 12px; + color: #ff5a5f; +} + +.shop-price-text { + font-size: 16px; +} + +.hot-tag { + background: #ff5a5f; + border: none; + color: #fff; +} + +.button-box { + height: 30px; + line-height: 30px; + font-size: 12px; + background: #007AFF; + color: #fff; +} + +.uni-flex-row { + display: flex; + +} + +.uni-link { + flex-shrink: 0; + margin-right: 10px; +} + +.ellipsis { + margin-left: auto; + display: flex; + overflow: hidden; +} + +.uni-ellipsis-1 { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.uni-ellipsis-2 { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + + +// 榛樿鍔犲叆 scoped 锛屾墍浠ュ闈㈠姞涓�灞傛彁鍗囨潈閲� +.list { + .uni-list--waterfall { + + /* #ifndef H5 || APP-VUE */ + // 灏忕▼搴� 缂栬瘧鍚庝細澶氫竴灞傛爣绛撅紝鑰屽叾浠栧钩鍙版病鏈夛紝鎵�浠ラ渶瑕佺壒娈婂鐞嗕竴涓� + /deep/ .uni-list { + /* #endif */ + display: flex; + flex-direction: row; + flex-wrap: wrap; + padding: 5px; + box-sizing: border-box; + + /* #ifdef H5 || APP-VUE */ + // h5 鍜� app-vue 浣跨敤娣卞害閫夋嫨鍣紝鍥犱负榛樿浣跨敤浜� scoped 锛屾墍浠ユ牱寮忎細鏃犳硶绌块�� + /deep/ + /* #endif */ + .uni-list-item--waterfall { + // width: 50%; + display: flex; + box-sizing: border-box; + margin-bottom: 10px; + background-color: white; + padding: 10px; + + .uni-list-item__container { + padding: 5px; + flex-direction: column; + } + } + + /* #ifndef H5 || APP-VUE */ + } + + /* #endif */ + } +} + + +.btn { + background: $light-color; + position: fixed; + width: 690rpx; + bottom: 60rpx; + height: 80rpx; + left: 30rpx; + font-size: 30rpx; + line-height: 80rpx; + + .u-icon { + margin-right: 10rpx; + } +} +</style> \ No newline at end of file diff --git a/pages/tabbar/user/utils/tool.vue b/pages/tabbar/user/utils/tool.vue index c2b86ec..447b221 100644 --- a/pages/tabbar/user/utils/tool.vue +++ b/pages/tabbar/user/utils/tool.vue @@ -101,7 +101,11 @@ <image src="/static/mine/setting.png" mode=""></image> <view>璁剧疆</view> </view> - + <view class="interact-item" @click="navigateTo('/pages/goods-manager/goodsList/goodsList')"> + <image src="/static/mine/setting.png" mode=""></image> + <view>鍟嗗搧绠$悊</view> + </view> + </view> </div> @@ -132,7 +136,8 @@ const ignores = [ '/pages/mine/set/setUp', '/pages/mine/set/editionIntro', - '/pages/mine/set/feedBack' + '/pages/mine/set/feedBack', + '/pages/goods-manager/goodsList/goodsList' ] if (!ignores.includes(url)) { if (this.$options.filters.tipsToLogin('normal')) { -- Gitblit v1.8.0