Переглянути джерело

Merge branch 'master' of http://code.xiudo.cn/yty/uni-xiudoyou

whyusb@gmail.com 4 роки тому
батько
коміт
4991903f5e

+ 2 - 2
src/config/index.config.js

@@ -2,8 +2,8 @@ const CONFIG = {
     //开发环境配置
     development: {
         assetsPath: '/static', // 静态资源路径
-        baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
-        // baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
+        // baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
+        baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
         hostUrl: 'http://localhost:8080',        // H5地址(前端运行地址)
         websocketUrl: '',        // websocket服务端地址
         weixinAppId: '' // 微信公众号appid

+ 26 - 17
src/pages/index/setting/editnotice.vue

@@ -43,7 +43,10 @@
             :src="noticeMessage.icon"
             v-if="noticeMessage.icon"
           ></image>
-          <view class="upload" @tap="upload">点击上传</view>
+          <view class="upload" @tap="upload">
+						<text class="load">点击上传</text>
+						<text class="per">{{progress}}%</text>
+					</view>
         </view>
         <view class="noticeContent">
           <view class="container">
@@ -88,7 +91,8 @@ export default {
       placeholder: '请输入公告内容',
       mastknow: '',
 
-      iconUrl: '',
+			iconUrl: '',
+			progress: 0,
       noticeMessage: {
         content: '',
         icon: '',
@@ -208,10 +212,10 @@ export default {
         sourceType: ['album'], // camera 使用相机   album 从相册中选
         success: function (res) {
           // 成功则返回图片的本地文件路径列表 tempFilePaths
-          _self.noticeMessage.icon = res.tempFilePaths[0];
-          uni.uploadFile({
+          _self.iconUrl = res.tempFilePaths[0];
+          const uploadTask = uni.uploadFile({
 						url: 'http://192.168.100.135:83/merch/common/upload/oss',
-						filePath: _self.noticeMessage.icon,
+						filePath: _self.iconUrl,
 						name: 'file',
 						formData: {
 							'user': 'test'
@@ -221,14 +225,13 @@ export default {
 							console.log(data);
 							_self.noticeMessage.icon = data.data
 						},
-						onUploadProgress: function (progressEvent) {
-              // 上传进度回调
-              let percentCompleted = Math.round(
-                (progressEvent.loaded * 100) / progressEvent.total
-							);
-							console.log(percentCompleted);
-            },
           });
+					uploadTask.onProgressUpdate((res)=>{
+						_self.progress = 1
+						setTimeout(() => {
+							_self.progress = res.progress
+						}, 500);
+					})
         },
       });
     },
@@ -300,16 +303,22 @@ export default {
     .icon {
       width: 185upx;
       height: 185upx;
-      background-color: pink;
       border-radius: 20upx;
     }
     .upload {
       width: 185upx;
       height: 185upx;
       border: 2px dashed #ccc;
-      text-align: center;
-      line-height: 185upx;
-      border-radius: 20upx;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			flex-direction: column;
+			.load {
+				margin-top: 25upx;
+			}
+			.per {
+				margin-top: 10upx;
+			}
     }
   }
   .noticeContent {
@@ -331,7 +340,7 @@ export default {
       font-size: 30upx;
       font-weight: 700;
       letter-spacing: 2upx;
-      background-color: #169bd5;
+      background-color: #9e5dfc;
     }
   }
 }

+ 1 - 1
src/pages/order/orderdetail.vue

@@ -12,7 +12,7 @@
 				<view class="ordernum titlebar">订单号:<text class="txt">{{orderMessage.ordersNo}}</text></view>
 				<view class="phonenum titlebar">手机号:<text class="txt">{{orderMessage.buyPhone}}</text></view>
 				<!-- <view class="goindate titlebar">入园日期:<text class="txt">{{orderMessage.timePart ? orderMessage.timePart : orderMessage.palyTime}}</text></view> -->
-				<view class="price titlebar">产品价格:<text class="txt">{{orderMessage.ordersPrice | doMoney}}</text></view>
+				<view class="price titlebar">产品价格:<text class="txt">{{orderMessage.price | doMoney}}</text></view>
 				<view class="buynum titlebar">购买数量:<text class="txt">{{orderMessage.playManList.length}}</text></view>
 				<view class="palytime titlebar">游玩时间:<text class="txt">{{orderMessage.timePart ? orderMessage.timePart : orderMessage.palyTime}}</text></view>
 				<view class="orderstatus titlebar">订单状态:<text class="txt">{{orderMessage.statusName}}</text> </view>

+ 38 - 8
src/pages/shop/classify.vue

@@ -27,21 +27,27 @@
           >
         </view>
         <view class="warp-bottom">
-          <view class="btn edtil" @tap="compile(item.id)">编辑</view>
+          <view class="btn edtil" @tap="compile(item)">编辑</view>
           <view class="btn delet" @tap="delet(item.id)">删除</view>
         </view>
       </view>
     </view>
-
+    <mask
+      :txt="masktxt"
+      :iconShow="iconShow"
+      v-if="isShowMask"
+      @isSureConver="isSureConver"
+    ></mask>
     <rf-loading v-if="loading"></rf-loading>
   </view>
 </template>
 
 <script>
 import Header from '../components/header';
+import mask from '../components/mask';
 export default {
   name: 'classify',
-  components: { Header },
+  components: { Header, mask },
   data() {
     //这里存放数据
     return {
@@ -50,17 +56,25 @@ export default {
       storeId: uni.getStorageSync('shopid'),
       lineList: [],
       gradeList: [],
+
+      masktxt: '',
+      iconShow: false,
+      isShowMask: false,
+
+      classId: ''
     };
   },
 
-     
+  onShow() {
+    this.getCustomList();
+  },
   onLoad() {
     this.getCustomList();
   },
   //方法集合
   methods: {
-    compile(id) {
-      uni.setStorageSync('classId', id)
+    compile(data) {
+      uni.setStorageSync('classData', data);
       this.$mRouter.push({ route: '/pages/shop/editclassify' });
     },
     // 自定义分类列表
@@ -71,7 +85,6 @@ export default {
           shopId: this.storeId,
         })
         .then(async (res) => {
-          console.log(res);
           if (res.code === 200) {
             this.lineList = res.data.customGroupList;
             this.loading = false;
@@ -81,7 +94,24 @@ export default {
 
     // 删除
     delet(id) {
-      console.log(id);
+      this.classId = id
+      this.isShowMask = true;
+      this.masktxt = '是否删除该分类?';
+    },
+    isSureConver(e) {
+      if (e) {
+        this.$http
+          .post('/goods/delCustomGroup?customGroupId='+this.classId)
+          .then((res) => {
+            if (res.code === 200 && res.msg === 'OK') {
+              this.$mHelper.toast('删除成功')
+              this.getCustomList()
+            }
+          });
+      } else {
+        this.$mHelper.toast('已取消删除')
+      }
+      this.isShowMask = false;
     },
   },
 };

+ 284 - 178
src/pages/shop/editclassify.vue

@@ -1,194 +1,300 @@
 <!-- editclassify -->
 <template>
-	<view class="editclassify">
-		<Header :title="title" />
-		<view style="height:94upx"></view>
-		<view class="content">
-			<view class="content-warp">
+  <view class="editclassify">
+    <Header :title="title" />
+    <view style="height: 94upx;"></view>
+    <view class="content">
+      <view class="content-warp">
+        
 				<view class="uni-list-cell">
-					<view class="name">选择店铺:</view>
-					<view class="uni-list-cell-db">
-						<picker
-							@change="bindPickerChange"
-							:value="storeIndex"
-							:range="storeList"
-							:disabled="storeDisabled"
-							range-key="name"
-							class="uni-upd"
-						>
-							<view class="uni-input">{{ storeList[storeIndex].name }}</view>
-						</picker>
-						<view class="icon-warp">
-							<!-- <image
-								src="../../../static/images/moreicon.png"
-								class="iconRight"
-							></image> -->
-						</view>
-					</view>
-				</view>
-				<view class="inputnamt">
-					<view class="title">新闻标题:</view>
-					<input
-						class="txt"
-						v-model="noticeMessage.title"
-						type="text"
-						placeholder="请输入新闻标题"
-						placeholder-style="color:#8f8f8f;"
-					/>
-				</view>
-				<view class="icon-warp">
-					<view class="title">上传图标:</view>
-					<image
-						class="icon"
-						:src="noticeMessage.icon"
-						v-if="noticeMessage.icon"
-					></image>
-					<view class="upload" @tap="upload">点击上传</view>
-				</view>
-				<view class="noticeContent">
-					<view class="container">
-						<editor
-							id="editor"
-							class="ql-container"
-							:placeholder="placeholder"
-							@input="saveTxt"
-							@ready="onEditorReady"
-						></editor>
-					</view>
-				</view>
-				<view class="btn-warp">
-					<view class="btn" @tap="saveNotice">提交发布</view>
-				</view>
-			</view>
-		</view>
-		<rf-loading v-if="loading"></rf-loading>
-	</view>
+          <view class="name">所属店铺:</view>
+          <view class="uni-list-cell-db">
+            <picker
+              @change="bindPickerChange"
+              :value="storeIndex"
+              :range="storeList"
+              :disabled="storeDisabled"
+              range-key="name"
+              class="uni-upd"
+            >
+              <view class="uni-input">{{ storeList[storeIndex].name }}</view>
+            </picker>
+            <view class="icon-warp">
+              <image
+                src="../../static/images/moreicon.png"
+                class="iconRight"
+              ></image>
+            </view>
+          </view>
+        </view>
+
+				<view class="uni-list-cell">
+          <view class="name">一级分类:</view>
+          <view class="uni-list-cell-db">
+            <picker
+              @change="classChange"
+              :value="classIndex"
+              :range="classList"
+              :disabled="classDisabled"
+              range-key="name"
+              class="uni-upd"
+            >
+              <view class="uni-input">{{ classList[classIndex].name }}</view>
+            </picker>
+            <view class="icon-warp">
+              <image
+                src="../../static/images/moreicon.png"
+                class="iconRight"
+              ></image>
+            </view>
+          </view>
+        </view>
+
+        <view class="inputnamt">
+          <view class="title">分组名称:</view>
+          <input
+            class="txt"
+            v-model="classname"
+            type="text"
+            placeholder="请输入分组名称"
+            placeholder-style="color:#8f8f8f;"
+          />
+        </view>
+
+        <view class="inputnamt">
+          <view class="title">分组标识:</view>
+          <input
+            class="txt"
+            v-model="classcode"
+            type="text"
+            placeholder="请输入分组标识"
+            placeholder-style="color:#8f8f8f;"
+          />
+        </view>
+
+        <view class="btn-warp">
+          <view class="btn" @tap="saveClass">提交</view>
+        </view>
+      </view>
+    </view>
+    <rf-loading v-if="loading"></rf-loading>
+  </view>
 </template>
 
 <script>
 import Header from '../components/header';
 export default {
-	name: 'editclassify',
-	components: {
-		Header
-	},
-	data() {
-		//这里存放数据
-		return {
-			loading: true,
-			title: '新增自定义分类',
-			classId: ''
-		};
+  name: 'editclassify',
+  components: {
+    Header,
+  },
+  data() {
+    //这里存放数据
+    return {
+      loading: true,
+      title: '新增自定义分类',
+			classData: '',
+			scenicId: '',
+
+			storeList: [{ name: '所属店铺', id: '' }],
+			storeIndex: 0,
+			storeId: '',
+			storeDisabled: true,
+
+			classList: [{name: '请选择', id: ''}],
+			classIndex: 0,
+			classId: '',
+			classDisabled: true,
+
+			classname: '',
+			classcode: ''
+
+    };
 	},
-	onLoad() {
-		this.classId = uni.getStorageSync('classId');
-		if (this.classId === 'add') {
+  onLoad() {
+    this.classData = uni.getStorageSync('classData');
+    console.log(this.classData);
+		this.getShopMessage()
+		this.getOneClass()
+    if (this.classData === 'add') {
 			this.loading = false;
-		} else {
-		}
-	},
-	//方法集合
-	methods: {}
+    } else {
+      this.title = '编辑自定义分类'
+      this.classname = this.classData.name
+      this.classcode = this.classData.code
+      this.loading = false
+    }
+  },
+  //方法集合
+  methods: {
+		// 商家信息
+    async getShopMessage() {
+      await this.$http.get('/getUserInfo').then(async (res) => {
+        if (res.data) {
+          this.scenicId = res.data.id;
+          this.getShopList();
+        }
+      });
+    },
+    // 所属店铺
+    async getShopList() {
+      this.storeList = [{ name: '所属店铺', id: '' }];
+      await this.$http
+        .get('/shop/getList', {
+          mid: this.scenicId,
+        })
+        .then(async (res) => {
+          if (res.data) {
+            let arr = [];
+            res.data.forEach((element) => {
+              arr.push({ name: element.name, id: element.id });
+            });
+						this.storeList = this.storeList.concat(arr);
+            this.storeDisabled = false
+            
+            // 回显
+            if (this.classData.shopId) {
+              this.storeList.forEach((element,index) => {
+                if (this.classData.shopId === element.id) {
+                  this.storeIndex = index
+                }
+              });
+              this.storeId = this.classData.shopId
+            }
+          }
+        });
+		},
+		// 选择店铺
+    bindPickerChange(e) {
+      this.storeIndex = e.detail.value;
+			this.storeId = this.storeList[this.storeIndex].id;
+		},
+		// 一级分类
+		async getOneClass () {
+			await this.$http.get('/type/getParentList',{}).then(async (res)=>{
+				if (res.code === 200 && res.msg==='OK') {
+					let arr =[]
+					res.data.forEach(element => {
+						arr.push({name: element.name,id:element.id})
+					});
+					this.classList = this.classList.concat(arr)
+          this.classDisabled = false
+          
+          // 回显
+          if (this.classData.typeId) {
+            this.classList.forEach((element,index) => {
+              if (this.classData.typeId === element.id) {
+                this.classIndex = index
+              }
+            });
+            this.classId = this.classData.typeId
+          }
+				}
+			})
+		},
+		// 选择一级分类
+		classChange (e) {
+			this.classIndex = e.detail.value;
+			this.classId = this.classList[this.classIndex].id
+		},
+		// 提交
+		async saveClass() {
+			this.loading = true
+			await this.$http.post('/goods/saveCustomGroup',{
+				id: this.classData === 'add' ? '' : this.classData.id,
+				name: this.classname,
+				code: this.classcode,
+				typeId: this.classId,
+				shopId: this.storeId
+			}).then(async (res)=>{
+				if (res.code === 200 && res.msg==='OK') {
+					this.$mHelper.toast('提交成功')
+					setTimeout(() => {
+						this.loading = false
+						this.$mRouter.back()
+					}, 800);
+				}
+			}).catch(error=>{
+        console.log(error);
+        this.loading = false
+      })
+		},
+
+		// -------------------------------------
+	
+		
+  },
 };
 </script>
 <style lang="scss" scoped>
 .editclassify {
-	.content {
-		padding: 25upx 0;
-	}
-	.content-warp {
-		padding: 0 33upx 100upx;
-		background-color: #fff;
-		box-sizing: border-box;
-	}
-	.uni-list-cell {
-		border-bottom: 2px solid #f4f4f4;
-		.name {
-			color: #2f2f2f;
-			font-size: 28upx;
-		}
-		.uni-list-cell-db {
-			height: 80upx;
-			font-size: 28upx;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			background-color: #fff;
-			color: #8f8f8f;
-			font-size: 30upx;
-			.uni-upd {
-				width: 100%;
-			}
-		}
-		.uni-input {
-			height: 100%;
-			line-height: 80upx;
-		}
-		.icon-warp {
-			width: 19upx;
-			.iconRight {
-				width: 19upx;
-				height: 27upx;
-			}
-		}
-	}
-	.inputnamt {
-		height: 80upx;
-		display: flex;
-		align-items: center;
-		border-bottom: 2px solid #f4f4f4;
-		.title {
-			color: #2f2f2f;
-		}
-		.txt {
-			flex: 1;
-		}
-	}
-	.icon-warp {
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		padding: 20upx 0;
-		border-bottom: 2px solid #f4f4f4;
-		.title {
-			color: #2f2f2f;
-		}
-		.icon {
-			width: 185upx;
-			height: 185upx;
-			background-color: pink;
-			border-radius: 20upx;
-		}
-		.upload {
-			width: 185upx;
-			height: 185upx;
-			border: 2px dashed #ccc;
-			text-align: center;
-			line-height: 185upx;
-			border-radius: 20upx;
-		}
-	}
-	.noticeContent {
-		padding: 40upx;
-		border: 2px solid #f4f4f4;
-		margin-top: 20upx;
-	}
-	.btn-warp {
-		margin-top: 80upx;
-		display: flex;
-		justify-content: center;
-		.btn {
-			width: 600upx;
-			height: 90upx;
-			border-radius: 20upx;
-			text-align: center;
-			line-height: 90upx;
-			color: #fff;
-			font-size: 30upx;
-			font-weight: 700;
-			letter-spacing: 2upx;
-			background-color: #169bd5;
-		}
-	}
+  .content {
+    padding: 25upx 0;
+  }
+  .content-warp {
+    padding: 0 33upx 100upx;
+    background-color: #fff;
+    box-sizing: border-box;
+  }
+  .uni-list-cell {
+    border-bottom: 2px solid #f4f4f4;
+    .name {
+      color: #2f2f2f;
+      font-size: 28upx;
+    }
+    .uni-list-cell-db {
+      height: 80upx;
+      font-size: 28upx;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      background-color: #fff;
+      color: #8f8f8f;
+      font-size: 30upx;
+      .uni-upd {
+        width: 100%;
+      }
+    }
+    .uni-input {
+      height: 100%;
+      line-height: 80upx;
+    }
+    .icon-warp {
+      width: 19upx;
+      .iconRight {
+        width: 19upx;
+        height: 27upx;
+      }
+    }
+  }
+  .inputnamt {
+    height: 80upx;
+    display: flex;
+    align-items: center;
+    border-bottom: 2px solid #f4f4f4;
+    .title {
+      color: #2f2f2f;
+    }
+    .txt {
+      flex: 1;
+    }
+  }
+  .btn-warp {
+    margin-top: 80upx;
+    display: flex;
+    justify-content: center;
+    .btn {
+      width: 600upx;
+      height: 90upx;
+      border-radius: 20upx;
+      text-align: center;
+      line-height: 90upx;
+      color: #fff;
+      font-size: 30upx;
+      font-weight: 700;
+      letter-spacing: 2upx;
+      background-color: #9e5dfc;
+    }
+  }
 }
 </style>