liujd 6 лет назад
Родитель
Сommit
10913d5e89

+ 3 - 0
mobile-code/src/api/common/index.js

@@ -12,3 +12,6 @@ export const getSelfApi = param => https.get('/admin/login-detail', param)
 
 // 常用链接 b
 export const commonUrl = param => https.get('/merchant/common-url', param)
+
+// 常用链接 b
+export const getFestList = param => https.get('/fest/list', param)

+ 7 - 0
mobile-code/src/api/goods/index.js

@@ -9,6 +9,13 @@ export const getDetail = data => {
 
 // =====================  B 端 ========================
 
+/** *
+ * 获取分类的商品 b
+ */
+export const getCategoryGoodsB = data => {
+	return https.get('/category/goods-list', data)
+}
+
 /** *
  * 商品-列表 b
  */

+ 3 - 1
mobile-code/src/pages/admin/order.vue

@@ -5,7 +5,9 @@
 			<block v-if="!$util.isEmpty(list.data)">
 				<div class="list" v-for="(item, index) in list.data" :key="index" @click="$util.pageTo({
 					url: '/pages/order/admin/detail',
-					id: item.id
+					query: {
+						id: item.id
+					}
 				})">
 					<div class="list-top flex-center-between">
 						<div class="app-color-3">订单编号:{{ item.sendNum }}</div>

+ 182 - 81
mobile-code/src/pages/goodsManage/add.vue

@@ -1,91 +1,101 @@
 <template>
 	<div class="app-content">
 		<!-- 商品基本信息 -->
-		<div class="module-com input-line-wrap">
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title required">名称</div>
-				<input v-model="form.receiveUserName" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="number" />
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">已售</div>
-				<input v-model="form.receiveUserName" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="number" />
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">库存</div>
-				<input v-model="form.receiveUserName" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="number" />
-			</tui-list-cell>
-			<tui-list-cell class="line-cell category-wrap" :hover="false">
-				<div class="tui-title">类型</div>
-				<div class="tui-input">
-					<button class="admin-button-com default" v-for="(item, index) in 6" :key="index">M</button>
-				</div>
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">价格</div>
-				<input v-model="form.receiveUserName" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="number" />
-				<div class="tui-prompt">元</div>
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :arrow="true">
-				<div class="tui-title">分类</div>
-				<div v-if="form.receiveFullAddress" class="tui-input">{{ form.receiveFullAddress }}</div>
-				<div v-else class="tui-placeholder">请选择</div>
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">节假日自动涨价</div>
-				<label for="autoPrice" class="tui-input">
-					<checkbox id="autoPrice" class="ljd-checkbox" checked @change="giftChange"></checkbox>
-					<span>需要</span>
-				</label>
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">配送方式</div>
-				<label for="autoPrice" class="tui-input">
-					<checkbox id="autoPrice" class="ljd-checkbox" checked @change="giftChange"></checkbox>
-					<span>到店自提</span>
-				</label>
-			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">运费</div>
-				<radio-group class="tui-input flex-center-between" @change="radioChange">
-					<label class="list" for="customLink">
-						<radio id="customLink" value="自定义链接" checked="checked" />
-						<span class="checkbox-text">按距离收费</span>
+		<form @submit="formSubmit">
+			<div class="module-com input-line-wrap">
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title required">名称</div>
+					<input v-model="form.goodsName" placeholder-class="phcolor" class="tui-input" name="goodsName" placeholder="请输入" maxlength="50" type="text" />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">已售</div>
+					<input v-model="form.sold" placeholder-class="phcolor" class="tui-input" name="sold" placeholder="请输入" maxlength="50" type="number" />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">库存</div>
+					<input v-model="form.stock" placeholder-class="phcolor" class="tui-input" name="stock" placeholder="请输入" maxlength="50" type="number" />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell category-wrap" :hover="false">
+					<div class="tui-title">类型</div>
+					<div class="tui-input">
+						<block v-for="(item, index) in categoryData" :key="index">
+							<button class="admin-button-com" :class="[form.categoryIdList.includes(item.id) ? '' : 'default']" @click="selCategoryFn(item)">{{ item.categoryName || '暂无' }}</button>
+						</block>
+					</div>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">价格</div>
+					<input v-model="form.price" placeholder-class="phcolor" class="tui-input" name="price" placeholder="请输入" maxlength="50" type="number" />
+					<div class="tui-prompt">元</div>
+				</tui-list-cell>
+				<!-- <tui-list-cell class="line-cell" :arrow="true">
+					<div class="tui-title">分类</div>
+					<div v-if="form.receiveFullAddress" class="tui-input">{{ form.receiveFullAddress }}</div>
+					<div v-else class="tui-placeholder">请选择</div>
+				</tui-list-cell>-->
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">节假日自动涨价</div>
+					<label for="autoPrice" class="tui-input" @click="autoRiseChange(form.autoRise)">
+						<checkbox id="autoPrice" class="ljd-checkbox" :checked="form.autoRise == 1"></checkbox>
+						<span>需要</span>
 					</label>
-					<label class="list" for="goodsLink">
-						<radio id="goodsLink" value="链接商品" />
-						<span class="checkbox-text">免运费</span>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">配送方式</div>
+					<label for="autoPrice" class="tui-input" @click="needSendChange(form.needSend)">
+						<checkbox id="autoPrice" class="ljd-checkbox" :checked="form.needSend == 1" @change="giftChange"></checkbox>
+						<span>到店自提</span>
 					</label>
-				</radio-group>
-			</tui-list-cell>
-		</div>
-		<!-- 商品图片 -->
-		<div class="module-com input-line-wrap goods-wrap">
-			<div class="module-tit">
-				<span>商品图片</span>
-				<span class="app-color-3">(最多上传4张)</span>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">运费</div>
+					<radio-group class="tui-input flex-center-between" @change="freightChange">
+						<label class="list" for="customLink">
+							<radio id="customLink" value="0" :checked="form.freightType == 0" />
+							<span class="checkbox-text">按距离收费</span>
+						</label>
+						<label class="list" for="goodsLink">
+							<radio id="goodsLink" value="1" :checked="form.freightType == 1" />
+							<span class="checkbox-text">免运费</span>
+						</label>
+					</radio-group>
+				</tui-list-cell>
 			</div>
-			<div class="module-det">
-				<app-uploader :multiple="false" ref="appUploader" :imgList.sync="imgList" />
+			<!-- 商品图片 -->
+			<div class="module-com input-line-wrap goods-wrap">
+				<div class="module-tit">
+					<span>商品图片</span>
+					<span class="app-color-3">(最多上传4张)</span>
+				</div>
+				<div class="module-det">
+					<app-uploader :multiple="false" ref="appUploader" :imgList.sync="form.shopImg" />
+				</div>
 			</div>
-		</div>
-		<!-- 商品简介 -->
-		<div class="module-com input-line-wrap summary-wrap">
-			<div class="module-tit">商品简介</div>
-			<div class="module-det">
-				<textarea class="goods-summary" placeholder-class="phcolor" @blur="bindTextAreaBlur" placeholder="请输入商品简介" />
+			<!-- 商品简介 -->
+			<div class="module-com input-line-wrap summary-wrap">
+				<div class="module-tit">商品简介</div>
+				<div class="module-det" style="padding-bottom: 10px">
+					<span class="app-price">商品简介请在电脑端进行修改</span>
+					<!-- <textarea class="goods-summary" placeholder-class="phcolor" @blur="bindTextAreaBlur" placeholder="请输入商品简介" /> -->
+				</div>
 			</div>
-		</div>
-		<!-- button -->
-		<div class="app-footer">
-			<button class="admin-button-com middle default">上架出售</button>
-			<button class="admin-button-com middle blue">加入仓库</button>
-		</div>
+			<!-- button -->
+			<div class="app-footer">
+				<button class="admin-button-com middle default" formType="submit" @click="status = 1">上架出售</button>
+				<button class="admin-button-com middle blue" formType="submit" @click="status = 0">加入仓库</button>
+			</div>
+		</form>
 	</div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import TuiListCell from '@/components/plugin/list-cell'
 import AppUploader from '@/components/app-uploader'
+const form = require('@/utils/formValidation.js')
+// api
+import { getCategory } from '@/utils/config'
+import { getDetailB, categoryAddB, categoryUpdateB } from '@/api/goods'
 export default {
 	name: 'goods-add',
 	components: {
@@ -94,8 +104,98 @@ export default {
 	},
 	data() {
 		return {
-			form: {},
-			imgList: []
+			// 上架状态
+			status: 1,
+			form: {
+				goodsName: '',
+				stock: '',
+				price: '',
+				categoryIdList: [],
+				// goodsStyle: '1',
+				// content: '',
+				autoRise: '1',
+				needSend: '0',
+				freightType: '0',
+				shopImg: []
+				// goodsStyleList: [],
+			},
+			shopImg: []
+		}
+	},
+	computed: {
+		...mapGetters({ categoryData: 'getCategory' })
+	},
+	onLoad() {
+		this.init()
+	},
+	methods: {
+		init() {
+			getCategory().then(() => {
+				if (this.option.id) {
+					this._getDet()
+				}
+			})
+		},
+		_getDet() {
+			return getDetailB({ id: this.option.id }).then(res => {
+				if (this.$util.isEmpty(res.data)) return
+				// res.data.categoryData = res.data.festIdList.map(e => e + '')
+				Object.keys(this.form).forEach((i, index) => {
+					this.form[i] = res.data[i]
+				})
+			})
+		},
+		// 确认
+		confirmFn() {
+			let host = this.option.id ? categoryUpdateB : categoryAddB
+			host({
+				status: this.status,
+				...this.form
+			}).then(res => {
+				this.$msg('操作成功!')
+			})
+		},
+		// operate
+		selCategoryFn(item) {
+			let index = this.form.categoryIdList.findIndex(e => e == item.id)
+			if (index == -1) {
+				this.form.categoryIdList.push(item.id)
+			} else {
+				this.form.categoryIdList.splice(index, 1)
+			}
+			console.log(this.form.categoryIdList)
+		},
+		autoRiseChange(e) {
+			this.form.autoRise = e == '0' ? '1' : '0'
+		},
+		needSendChange(e) {
+			this.form.needSend = e == '0' ? '1' : '0'
+		},
+		freightChange(e) {
+			this.form.freightType = e.detail.value
+		},
+		// 表单验证
+		formSubmit(e) {
+			console.log(e)
+			// 表单规则
+			let rules = [
+				{
+					name: 'goodsName',
+					rule: ['required'],
+					msg: ['请输入商品名']
+				}
+			]
+			// 进行表单检查
+			let formData = e.detail.value
+			let checkRes = form.validation(formData, rules)
+			// 验证通过!
+			if (!checkRes) {
+				setTimeout(() => {
+					this.confirmFn()
+				})
+			} else {
+				this.$msg(checkRes)
+			}
 		}
 	}
 }
@@ -123,16 +223,17 @@ export default {
 	}
 	.category-wrap {
 		align-items: flex-start;
+		padding-bottom: 0 !important;
 		.tui-input {
 			@include disFlex(center, flex-start);
 			flex-wrap: wrap;
 			.admin-button-com {
-				width: 104px;
-				margin-left: 20px;
+				// width: 104px;
+				margin-right: 20px;
 				margin-bottom: 20px;
-				&:nth-child(4n + 1) {
-					margin-left: 0;
-				}
+				// &:nth-child(4n + 1) {
+				// 	margin-left: 0;
+				// }
 			}
 		}
 	}

+ 301 - 6
mobile-code/src/pages/goodsManage/list.vue

@@ -1,8 +1,44 @@
 <template>
-	<div class="app-content">
+	<div class="app-content" @click="operateBottomShow = false">
+		<app-tabs :tabs="tabs" :isFixed="true" :currentTab="tabIndex" @change="change" itemWidth="50%" />
+		<!-- 中间 -->
+		<div class="app-middle">
+			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" :style="{height:height+'px'}">
+				<div v-for="(item,index) in tabbar" :key="index" class="tab-bar-item" :class="[currentTab==index ? 'active' : '']" :data-current="index" @tap.stop="swichNav($event ,item)">
+					<text>{{item.categoryName || '暂无'}}</text>
+				</div>
+			</scroll-view>
+			<block v-for="(item,index) in tabbar" :key="index">
+				<scroll-view scroll-y class="right-box" :style="{height:height+'px'}" v-if="currentTab==index">
+					<!--内容部分 start -->
+					<block v-if="!$util.isEmpty(list.data)">
+						<div class="page-view">
+							<div class="goods-list" v-for="(item, index) in list.data" :key="index" @click="$util.pageTo(`/pages/goods/detail?id=${item.id}`)">
+								<div class="img-blo">
+									<img :src="item.imgList[0].middle" alt="商品图" mode="center" />
+								</div>
+								<div class="goods-det">
+									<div class="goods-det-top">
+										<div class="goods-name">{{ item.goodsName }}</div>
+										<div class="goods-sales">已售{{ item.sold }}</div>
+									</div>
+									<div class="goods-price">¥{{ item.price }}</div>
+								</div>
+							</div>
+						</div>
+						<!-- 操作 -->
+						<operate-module v-show="operateShow" :top="operateTop" :right="30" :btnData="btnData" />
+					</block>
+					<block v-else>
+						<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+					</block>
+					<!--内容部分 end -->
+				</scroll-view>
+			</block>
+		</div>
 		<!-- 底部 -->
 		<div class="app-footer">
-			<div class="btn-list other-btn">
+			<div class="btn-list other-btn" @click.stop="changeOperateShowFn">
 				<i class="iconfont iconxiala"></i>
 				<span>其他设置</span>
 			</div>
@@ -14,21 +50,55 @@
 			</div>
 		</div>
 		<!-- 操作弹窗 -->
-		<operate-line-module v-if="operateShow" :btnData="btnData" :top="800" :right="528" />
+		<operate-line-module v-if="operateBottomShow" :btnData="btnBottomData" :bottom="120" :right="528" />
 	</div>
 </template>
 
 <script>
+import AppTabs from '@/components/plugin/tabs'
+import OperateModule from '@/pages/admin/components/module/operate'
 import OperateLineModule from '@/pages/admin/components/module/operate-line'
+import AppWrapperEmpty from '@/components/app-wrapper-empty'
+// api
+import { categoryListB, getCategoryGoodsB } from '@/api/goods'
+import { list } from '@/mixins'
 export default {
 	name: 'goods-manage-list',
 	components: {
-		OperateLineModule
+		AppTabs,
+		OperateLineModule,
+		OperateModule,
+		AppWrapperEmpty
 	},
+	mixins: [list],
 	data() {
 		return {
-			operateShow: true,
-			btnData: [
+			// tabs
+			tabIndex: 0,
+			tabs: [
+				{
+					name: '出售中'
+				},
+				{
+					name: '已下架'
+				}
+			],
+			// 中间
+			tabbar: [],
+			height: 0, // scroll-view高度
+			currentTab: 0, // 预设当前项的值
+			scrollTop: 0, // tab标题的滚动条位置
+			form: {
+				categoryId: ''
+			},
+			// 操作菜单
+			operateData: {},
+			operateShow: false,
+			operateIndex: null,
+			operateTop: 0,
+			// 底部操作
+			operateBottomShow: false,
+			btnBottomData: [
 				{
 					name: '图库管理',
 					click: () => this.$util.pageTo('/pages/goodsManage/img-store')
@@ -47,11 +117,236 @@ export default {
 				}
 			]
 		}
+	},
+	computed: {
+		btnData() {
+			return [
+				{
+					text: '置顶',
+					icon: 'iconzhiding',
+					click: () => {
+						this.delModal = true
+					}
+				},
+				{
+					text: '编辑',
+					icon: 'iconbianji',
+					click: () => {
+						this.$util.pageTo({
+							url: '/pages/ad/add',
+							query: {
+								type: this.tabIndex,
+								id: this.operateData.id
+							}
+						})
+					}
+				},
+				{
+					text: this.operateData.status == 1 ? '下架' : '启用',
+					icon: this.operateData.status == 1 ? 'iconxiajia' : 'iconqiyong',
+					click: () => {
+						this.changeStatusFn()
+					}
+				},
+				{
+					text: '删除',
+					icon: 'iconshanchu1',
+					click: () => {
+						this.delModal = true
+					}
+				}
+			]
+		}
+	},
+	onLoad: function() {
+		setTimeout(() => {
+			uni.getSystemInfo({
+				success: res => {
+					this.height = res.windowHeight - 90
+					this.init()
+				}
+			})
+		}, 50)
+	},
+	methods: {
+		async init() {
+			this._getClass()
+			this._list()
+		},
+		// 分类
+		_getClass() {
+			categoryListB().then(res => {
+				this.tabbar = res.data
+			})
+		},
+		// 列表
+		_list() {
+			return getCategoryGoodsB({
+				status: this.tabIndex == 0 ? 1 : 0,
+				...this.form
+			}).then(res => {
+				this.completes(res)
+			})
+		},
+		// tabs
+		change(e) {
+			if (this.tabIndex == e.index) {
+				return false
+			} else {
+				this.tabIndex = e.index
+				this.operateCloseFn()
+				this.resetList()
+				this._list()
+			}
+		},
+		// 操作按钮
+		operateFn(item, index) {
+			if (this.operateIndex == index) {
+				this.operateCloseFn()
+			} else {
+				this.operateData = item
+				this.operateData.index = index
+				this.operateIndex = index
+				this.operateTop = (index + 1) * 214
+				this.operateShow = true
+			}
+		},
+		// 关闭操作按钮
+		operateCloseFn() {
+			this.operateData = {}
+			this.operateIndex = null
+			this.operateShow = false
+		},
+		// 点击标题切换当前页时改变样式
+		swichNav(e, item) {
+			let cur = e.currentTarget.dataset.current
+			if (this.currentTab == cur) {
+				return false
+			} else {
+				this.currentTab = cur
+				this.form.categoryId = item.id
+				this.resetList()
+				this._list()
+				// this.checkCor()
+			}
+		},
+		// 判断当前滚动超过一屏时,设置tab标题滚动条。
+		checkCor() {
+			let that = this
+			// 这里计算按照实际情况进行修改,动态数据要进行动态分析
+			// 思路:窗体高度/单个分类高度 200rpx 转px计算 =>得到一屏幕所显示的个数,结合后台传回分类总数进行计算
+			// 数据很多可以多次if判断然后进行滚动距离计算即可
+			if (that.currentTab > 7) {
+				that.scrollTop = 500
+			} else {
+				that.scrollTop = 0
+			}
+		},
+		// operate
+		changeOperateShowFn() {
+			this.operateBottomShow = !this.operateBottomShow
+		}
 	}
 }
 </script>
 
 <style lang="scss" scoped>
+	.app-content {
+		min-height: calc(100vh - 80px);
+		padding-top: 80px;
+		// padding-bottom: 100px;
+	}
+
+	page {
+		background: #fff;
+	}
+
+	/* 左侧导航布局 start*/
+
+	/* 隐藏scroll-view滚动条*/
+
+	::-webkit-scrollbar {
+		width: 0;
+		height: 0;
+		color: transparent;
+	}
+
+	.tab-view {
+		/* height: 100%; */
+		width: 200upx;
+		position: fixed;
+		left: 0;
+		z-index: 10;
+		background-color: #f0f2f6;
+
+		.tab-bar-item {
+			width: 200upx;
+			height: 110upx;
+			box-sizing: border-box;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			font-size: 26upx;
+			color: #444;
+			font-weight: 400;
+		}
+
+		.active {
+			position: relative;
+			color: $mainColor;
+			font-size: 26px;
+			background: #fff;
+		}
+
+		.active::before {
+			content: '';
+			position: absolute;
+			border-left: 8upx solid $mainColor;
+			height: 100%;
+			left: 0;
+		}
+	}
+
+	/* 左侧导航布局 end*/
+
+	.right-box {
+		width: 100%;
+		position: fixed;
+		padding-left: 220upx;
+		box-sizing: border-box;
+		left: 0;
+		.page-view {
+			width: 100%;
+			overflow: hidden;
+			box-sizing: border-box;
+			padding-bottom: env(safe-area-inset-bottom);
+			.goods-list {
+				@include disFlex(flex-start, flex-start);
+				margin: 40px 0;
+				.img-blo {
+					width: 200px;
+					height: 200px;
+					margin-right: 20px;
+				}
+				.goods-det {
+					padding-top: 18px;
+					font-size: 28px;
+					.goods-name {
+						margin-bottom: 10px;
+					}
+					.goods-sales {
+						color: $fontColor3;
+						font-size: 24px;
+					}
+					.goods-price {
+						margin-top: 50px;
+						color: $mainColor;
+						font-weight: bold;
+					}
+				}
+			}
+		}
+	}
 	// 底部
 	.app-footer {
 		justify-content: space-between;

+ 83 - 19
mobile-code/src/pages/goodsManage/price-increase.vue

@@ -3,57 +3,121 @@
 		<div class="module-com flex-center-between switch-blo">
 			<div class="app-size-32">开启自动涨价</div>
 			<div>
-				<switch checked @change="switchChangeFn" />
+				<switch :checked="form.riseSwitch == '0' ? false : true" @change="switchChangeFn" />
 			</div>
 		</div>
 		<!-- 选项设置 -->
 		<div class="input-line-wrap new-wrap">
 			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">旧密码</div>
+				<div class="tui-title">要涨价节日</div>
 				<div class="tui-input button-wrap">
-					<button class="admin-button-com">2.14情人节</button>
-					<button class="admin-button-com default">七夕节</button>
-					<button class="admin-button-com">母亲节</button>
+					<block v-for="(item, index) in festData" :key="index">
+						<button class="admin-button-com" :class="[form.festIdList.includes(item.id) ? '' : 'default']" @click="selFestFn(item)">{{ item.name || '暂无' }}</button>
+					</block>
 				</div>
 			</tui-list-cell>
 			<tui-list-cell class="line-cell" :hover="false">
 				<div class="tui-title">涨价方式</div>
 				<radio-group class="tui-input flex-center-between" @change="radioChange">
 					<label class="list" for="customLink">
-						<radio id="customLink" value="自定义链接" checked="checked" />
+						<radio id="customLink" value="0" :checked="form.riseType == 0"/>
 						<span class="checkbox-text">按百分比</span>
 					</label>
 					<label class="list" for="goodsLink">
-						<radio id="goodsLink" value="链接商品" />
+						<radio id="goodsLink" value="1" :checked="form.riseType == 1"/>
 						<span class="checkbox-text">按金额</span>
 					</label>
 				</radio-group>
 			</tui-list-cell>
-			<tui-list-cell class="line-cell" :hover="false">
-				<div class="tui-title">比例</div>
-				<input placeholder-class="phcolor" class="tui-input" name="phone" placeholder="涨价10%,请输入10" maxlength="50" type="number" />
-			</tui-list-cell>
+			<block v-if="form.riseType == 0">
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">比例</div>
+					<input v-model="form.riseAmount" placeholder-class="phcolor" class="tui-input" name="phone" placeholder="涨价10%,请输入10" maxlength="50" type="number" />
+				</tui-list-cell>
+			</block>
+			<block v-else>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">金额</div>
+					<input v-model="form.riseAmount" placeholder-class="phcolor" class="tui-input" name="phone" placeholder="涨价80元请输入80" maxlength="50" type="number" />
+				</tui-list-cell>
+			</block>
 		</div>
 		<div class="prompt-text">提示:在节日的前一天和当天,商城设置自动涨价的商品将会全部 统一涨价。过后自动恢复原价。</div>
-		<button class="admin-button-com blue big confirm-btn">确定</button>
+		<button class="admin-button-com blue big confirm-btn" @click="setPrice">确定</button>
 	</div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import TuiListCell from '@/components/plugin/list-cell'
+// api
+import { getFest } from '@/utils/config'
+import { getRise, updateRise } from '@/api/goods'
 export default {
 	name: 'setting-price-increase',
 	components: {
 		TuiListCell
 	},
 	data() {
-		return {}
+		return {
+			radioVal: '0',
+			form: {
+				riseSwitch: '0',
+				riseType: '0',
+				festIdList: [],
+				riseAmount: ''
+			}
+		}
+	},
+	computed: {
+		...mapGetters({ festData: 'getFest' })
+	},
+	onLoad() {
+		this.init()
 	},
 	methods: {
+		init() {
+			getFest().then(() => {
+				this._getDet()
+			})
+		},
+		_getDet() {
+			return getRise().then(res => {
+				if (this.$util.isEmpty(res.data)) return
+				res.data.festIdList = res.data.festIdList.map(e => e + '')
+				Object.keys(this.form).forEach((i, index) => {
+					this.form[i] = res.data[i]
+				})
+			})
+		},
+		setPrice() {
+			if (this.form.festIdList.length == 0) {
+				this.$msg('请先选择节日!')
+				return false
+			}
+			if (!this.form.riseAmount) {
+				this.$msg('请先输入比例或者金额!')
+				return false
+			}
+			updateRise(this.form).then(res => {
+				this.$msg('更新成功!')
+			})
+		},
+		selFestFn(item) {
+			let index = this.form.festIdList.findIndex(e => e == item.id)
+			if (index == -1) {
+				this.form.festIdList.push(item.id)
+			} else {
+				this.form.festIdList.splice(index, 1)
+			}
+		},
 		switchChangeFn(e) {
-			console.log('switch1 发生 change 事件,携带值为', e.target.value)
+			this.form.riseSwitch = e.detail.value ? '1' : '0'
 		},
-		radioChange() {}
+		radioChange(e) {
+			this.form.riseAmount = ''
+			this.form.riseType = e.detail.value
+		}
 	}
 }
 </script>
@@ -91,11 +155,11 @@ export default {
 			.admin-button-com {
 				padding-top: 12px;
 				padding-bottom: 12px;
-				margin-left: 20px;
+				margin-right: 20px;
 				border-radius: 4px;
-				&:first-child {
-					margin-left: 0;
-				}
+				// &:first-child {
+				// 	margin-left: 0;
+				// }
 			}
 		}
 	}

+ 7 - 7
mobile-code/src/pages/home/category.vue

@@ -7,7 +7,7 @@
 		</scroll-view>
 		<block v-for="(item,index) in tabbar" :key="index">
 			<scroll-view scroll-y class="right-box" :style="{height:height+'px'}" v-if="currentTab==index">
-				<!--内容部分 start 自定义可删除-->
+				<!--内容部分 start -->
 				<div class="page-view" v-if="!$util.isEmpty(list.data)">
 					<div class="goods-list" v-for="(item, index) in list.data" :key="index" @click="$util.pageTo(`/pages/goods/detail?id=${item.id}`)">
 						<div class="img-blo">
@@ -25,7 +25,7 @@
 				<block v-else>
 					<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
 				</block>
-				<!--内容部分 end 自定义可删除-->
+				<!--内容部分 end -->
 			</scroll-view>
 		</block>
 	</div>
@@ -199,9 +199,9 @@ export default {
 			}
 		}
 	}
-	img {
-		width: 100%;
-		height: 100%;
-		display: inline-block;
-	}
+	// img {
+	// 	width: 100%;
+	// 	height: 100%;
+	// 	display: inline-block;
+	// }
 </style>

+ 5 - 3
mobile-code/src/static/css/reset.scss

@@ -67,15 +67,17 @@ uni-picker .uni-picker-item {
 
 // 修改checkbox 样式
 .ljd-checkbox,.ljd-checkbox .uni-checkbox-input {
-    // width: 46px;
-    height: 46px;
+    width: 42px;
+    height: 42px;
     border-radius: 50% !important;
+    margin-right: 12px;
 }
 
 .ljd-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
 	color: #fff !important;
 	background-color: $mainColor !important;
-	border: none !important;
+    // border: none !important;
+    border-color: $mainColor !important;
 }
 
 .ljd-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {

+ 26 - 6
mobile-code/src/store/modules/config.js

@@ -1,12 +1,10 @@
 import store from '@/store'
 import UTIL from '@/utils/util'
-import {
-	getList as getLevelList
-} from '@/api/level'
 /** 字典配置 */
 const state = {
 	level: {},
-	category: {}
+	category: [],
+	fest: []
 }
 
 const getters = {
@@ -16,7 +14,11 @@ const getters = {
 	},
 	// 分类数据
 	getCategory: (state) => {
-		return state.category || {}
+		return state.category || []
+	},
+	// 节日数据
+	getFest: (state) => {
+		return state.fest || []
 	}
 }
 
@@ -42,6 +44,17 @@ const actions = {
 		commit
 	}) {
 		commit('DEL_CATEGORY')
+	},
+	// 节日数据
+	setFest({
+		commit
+	}, data) {
+		commit('SET_FEST', data)
+	},
+	delFest({
+		commit
+	}) {
+		commit('DEL_FEST')
 	}
 }
 
@@ -54,11 +67,18 @@ const mutations = {
 		state.level = ''
 	},
 	// 分类信息
-	SET_CATEGORY(state, data = {}) {
+	SET_CATEGORY(state, data = []) {
 		state.category = data
 	},
 	DEL_CATEGORY(state) {
 		state.category = ''
+	},
+	// 节日信息
+	SET_FEST(state, data = []) {
+		state.fest = data
+	},
+	DEL_FEST(state) {
+		state.fest = ''
 	}
 }
 

+ 22 - 0
mobile-code/src/utils/config.js

@@ -8,6 +8,9 @@ import {
 import {
 	categoryListB as getCategoryList
 } from '@/api/goods'
+import {
+	getFestList
+} from '@/api/common'
 
 /**
  * 获取等级列表
@@ -46,3 +49,22 @@ export async function getCategory(update) {
 
 	return data
 }
+
+/**
+ * 获取分类列表
+ * @parmas update为true时会重新触发请求,重置vuex的数据
+ */
+export async function getFest(update) {
+	let data = store.getters.getFest
+	if (!UTIL.isEmpty(data) && !update) {
+		return data
+	}
+	await getFestList().then(res => {
+		data = res.data
+		store.dispatch('setFest', data)
+	}).catch(() => {
+		return false
+	})
+
+	return data
+}