shish 4 лет назад
Родитель
Сommit
039b1f9394

+ 0 - 334
hdApp/src/admin/goodsManage/add.vue

@@ -1,334 +0,0 @@
-<template>
-  <div class="app-content">
-    <!-- 商品基本信息 -->
-    <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.name"
-            placeholder-class="phcolor"
-            class="tui-input"
-            name="name"
-            placeholder="请输入"
-            maxlength="50"
-            type="text"
-          />
-        </tui-list-cell>
-        <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title required">价格</div>
-          <input
-            v-model="form.price"
-            placeholder-class="phcolor"
-            class="tui-input"
-            name="price"
-            placeholder="请输入"
-            maxlength="50"
-            type="digit"
-          />
-        </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 + '')||form.categoryIdList.includes(item.id*1)) ? '' : '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.stock"
-            placeholder-class="phcolor"
-            class="tui-input"
-            name="stock"
-            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.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>
-          <label for="autoPrice" class="tui-input" @click="autoRiseChange(form.autoRise)">
-            <checkbox
-              id="autoPrice"
-              class="ljd-checkbox"
-              :checked="form.autoRise == 1"
-              style="transform: scale(0.7,0.7);"
-            ></checkbox>
-            <span>需要</span>
-          </label>
-        </tui-list-cell>
-        <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">配送类型</div>
-          <label for="sendType" class="tui-input" @click="needSendChange(form.needSend)">
-            <checkbox
-              id="sendType"
-              class="ljd-checkbox"
-              :checked="form.needSend == 1"
-              @change="giftChange"
-              style="transform: scale(0.7,0.7);"
-            ></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="freightChange">
-            <label class="list" for="customLink">
-              <radio
-                id="customLink"
-                value="0"
-                :checked="form.freightType == 0"
-                style="transform: scale(0.8,0.8);"
-              />
-              <span class="checkbox-text">按距离收费</span>
-            </label>
-            <label class="list" for="goodsLink">
-              <radio
-                id="goodsLink"
-                value="1"
-                :checked="form.freightType == 1"
-                style="transform: scale(0.8,0.8);"
-              />
-              <span class="checkbox-text">免运费</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>
-        </div>
-        <div class="module-det">
-          <app-uploader ref="appUploader" :imgList.sync="form.shopImg" :isMain="true" :num="4" />
-        </div>
-      </div>
-      <!-- 商品简介 -->
-      <div class="module-com input-line-wrap summary-wrap">
-        <div class="module-tit">商品简介</div>
-        <div class="module-det" style="padding-bottom: 10upx">
-          <textarea
-            v-model="form.briefContent"
-            class="goods-summary"
-            placeholder-class="phcolor"
-            placeholder="请输入商品简介"
-          />
-        </div>
-      </div>
-
-      <div class="app-footer">
-        <button class="admin-button-com middle default" formType="submit" @click="status = 0">保存</button>
-        <button class="admin-button-com middle blue" formType="submit" @click="status = 1">保存上架</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");
-import { getCategory } from "@/utils/config";
-import { getDetailB, addB, updateB } from "@/api/goods";
-export default {
-  name: "goods-add",
-  components: {
-    TuiListCell,
-    AppUploader
-  },
-  data() {
-    return {
-      status: 1,
-      form: {
-        name: "",
-        stock: "",
-        price: "",
-        categoryIdList: [],
-        autoRise: "1",
-        needSend: "0",
-        freightType: "0",
-        shopImg: [],
-        briefContent: ""
-      }
-    };
-  },
-  computed: {
-    ...mapGetters({ categoryData: "getCategory" })
-  },
-  onLoad() {
-  },
-  watch:{
-  },
-  methods: {
-    init() {
-      getCategory()
-        .then(() => {
-        if (this.option.id) {
-          uni.setNavigationBarTitle({
-              title: '修改商品'
-          });
-          this._getDet();
-        }
-      });
-    },
-    _getDet() {
-      return getDetailB({ id: this.option.id })
-        .then(res => {
-        if (this.$util.isEmpty(res.data)) {
-          return;
-        }
-        Object.keys(this.form).forEach((i, index) => {
-          this.form[i] = res.data[i];
-        });
-        if (this.form.stock == -1) {
-          this.$set(this.form, "stock", "");
-        }
-        this.$set(this.form, "sold", res.data.sold);
-        this.$set(this.form, "shopImg", res.data.imgList)
-      });
-    },
-    // 确认
-    confirmFn() {
-      if (this.form.categoryIdList == 0) {
-        this.$msg("请选择分类");
-        return false;
-      }
-      if (this.form.shopImg.length == 0) {
-        this.$msg("请上传图片");
-        return false;
-      }
-      let host = this.option.id ? updateB : addB;
-      let form = JSON.parse(JSON.stringify(this.form));
-      form.shopImg = this.$util.imgSubstr(form.shopImg);
-      if (form.stock == "") {
-        form.stock = -1;
-      }
-      if(this.option.id){
-        form.id = this.option.id 
-      }
-      host({
-        status: this.status,
-        ...form
-      }).then(res => {
-        uni.navigateBack({});
-        this.$msg("操作成功!");
-      });
-    },
-    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);
-      }
-    },
-    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) {
-      // 表单规则
-      let rules = [
-        {
-          name: "name",
-          rule: ["required"],
-          msg: ["请输入商品名"]
-        },
-        {
-          name: "price",
-          rule: ["required"],
-          msg: ["请输入价格"]
-        }
-      ];
-      // 进行表单检查
-      let formData = e.detail.value;
-      let checkRes = form.validation(formData, rules);
-      // 验证通过!
-      if (!checkRes) {
-        setTimeout(() => {
-          this.confirmFn();
-        });
-      } else {
-        this.$msg(checkRes);
-      }
-    }
-  }
-};
-</script>
-<style lang="scss" scoped>
-.app-content {
-  min-height: calc(100vh - 100upx);
-  padding-bottom: 100upx;
-}
-// 公共模块
-.module-com {
-  margin-bottom: 20upx;
-  background-color: #fff;
-  color: $fontColor2;
-  .module-tit {
-    padding: 20upx 30upx;
-    font-size: 28upx;
-  }
-  .module-det {
-    padding: 0 30upx;
-  }
-}
-.category-wrap {
-  align-items: flex-start;
-  padding-bottom: 0 !important;
-  .tui-input {
-    @include disFlex(center, flex-start);
-    flex-wrap: wrap;
-    .admin-button-com {
-      // width: 104upx;
-      margin-right: 20upx;
-      margin-bottom: 20upx;
-      position: relative;
-      z-index: 9999;
-      // &:nth-child(4n + 1) {
-      // 	margin-left: 0;
-      // }
-    }
-  }
-}
-.summary-wrap {
-  .goods-summary {
-    height: 400upx;
-    // font-size: 24upx;
-  }
-}
-// button
-.app-footer {
-  justify-content: space-evenly;
-  z-index: 9999;
-  .admin-button-com {
-    width: 46%;
-  }
-}
-</style>

+ 2 - 2
hdApp/src/admin/goodsManage/category.vue

@@ -105,10 +105,10 @@ export default {
                 },
                 {
                     value: 0,
-                    name: '盆栽绿植资材'
+                    name: '绿植盆栽资材'
                 }
             ],
-			//0非鲜花成品,绿植盆栽花瓶 1鲜花成品
+			//0 绿植盆栽资材 1 鲜花成品
             flower:1,
 			catDisabled:false
 		}

+ 639 - 0
hdApp/src/admin/goodsManage/components/htz-image-upload/htz-image-upload.vue

@@ -0,0 +1,639 @@
+<template>
+	<view class="htz-image-upload-list">
+		<view class="htz-image-upload-Item" v-for="(item,index) in uploadLists" :key="index">
+			<view class="htz-image-upload-Item-video" v-if="(!/.(gif|jpg|jpeg|png|gif|jpg|png)/i.test(item))">
+				<video :disabled="false" :controls="false" :src="item">
+					<cover-view class="htz-image-upload-Item-video-fixed" @click="previewVideo(item)"></cover-view>
+
+					<cover-view class="htz-image-upload-Item-del-cover" v-if="remove && previewVideoSrc==''"
+						@click="imgDel(index)">×</cover-view>
+
+				</video>
+
+			</view>
+
+			<image v-else :src="item" @click="imgPreview(item)"></image>
+
+			<view class="htz-image-upload-Item-del" v-if="remove" @click="imgDel(index)">×</view>
+		</view>
+		<view class="htz-image-upload-Item htz-image-upload-Item-add" v-if="uploadLists.length<max && add"
+			@click="chooseFile">
+			+
+		</view>
+		<view class="preview-full" v-if="previewVideoSrc!=''">
+			<video :autoplay="true" :src="previewVideoSrc" :show-fullscreen-btn="false">
+				<cover-view class="preview-full-close" @click="previewVideoClose"> × </cover-view>
+			</video>
+		</view>
+
+	</view>
+</template>
+
+<style>
+	.ceshi {
+		width: 100%;
+		height: 100%;
+		position: relative;
+		top: 0;
+		left: 0;
+		bottom: 0;
+		right: 0;
+		background-color: #FFFFFF;
+		color: #2C405A;
+		opacity: 0.5;
+		z-index: 100;
+	}
+</style>
+
+<script>
+	export default {
+		name: 'htz-image-upload',
+		props: {
+			max: { //展示图片最大值
+				type: Number,
+				default: 1,
+			},
+			chooseNum: { //选择图片数
+				type: Number,
+				default: 9,
+			},
+			name: { //发到后台的文件参数名
+				type: String,
+				default: 'file',
+			},
+			remove: { //是否展示删除按钮
+				type: Boolean,
+				default: true,
+			},
+			add: { //是否展示添加按钮
+				type: Boolean,
+				default: true,
+			},
+			disabled: { //是否禁用
+				type: Boolean,
+				default: false,
+			},
+			sourceType: { //选择照片来源 【ps:H5就别费劲了,设置了也没用。不是我说的,官方文档就这样!!!】
+				type: Array,
+				default: () => ['album', 'camera'],
+			},
+			action: { //上传地址
+				type: String,
+				default: '',
+			},
+			headers: { //上传的请求头部
+				type: Object,
+				default: () => {},
+			},
+			formData: { //HTTP 请求中其他额外的 form data
+				type: Object,
+				default: () => {},
+			},
+			compress: { //是否需要压缩
+				type: Boolean,
+				default: true,
+			},
+			quality: { //压缩质量,范围0~100
+				type: Number,
+				default: 80,
+			},
+			value: { //受控图片列表
+				type: Array,
+				default: () => [],
+			},
+			uploadSuccess: {
+				default: (res) => {
+					return {
+						success: false,
+						url: ''
+					}
+				},
+			},
+			mediaType: { //文件类型 image/video/all
+				type: String,
+				default: 'image',
+			},
+			maxDuration: { //拍摄视频最长拍摄时间,单位秒。最长支持 60 秒。 (只针对拍摄视频有用)
+				type: Number,
+				default: 60,
+			},
+			camera: { //'front'、'back',默认'back'(只针对拍摄视频有用)
+				type: String,
+				default: 'back',
+			},
+
+		},
+		data() {
+			return {
+				uploadLists: [],
+				mediaTypeData: ['image', 'video', 'all'],
+				previewVideoSrc: '',
+			}
+		},
+		mounted: function() {
+			let that = this
+			this.$nextTick(function() {
+				this.uploadLists = this.value;
+				if (this.mediaTypeData.indexOf(this.mediaType) == -1) {
+					that.$util.confirmModal({content:'mediaType参数不正确'},() => {
+						//console.log('用户点击确定');
+					})
+				}
+			});
+		},
+		watch: {
+			value(val, oldVal) {
+				//console.log('value',val, oldVal)
+				this.uploadLists = val;
+			},
+		},
+		methods: {
+			previewVideo(src) {
+				this.previewVideoSrc = src;
+				// this.previewVideoSrc =
+				// 	'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-fbd63a76-dc76-485c-b711-f79f2986daeb/ba804d82-860b-4d1a-a706-5a4c8ce137c3.mp4'
+			},
+			previewVideoClose() {
+				this.previewVideoSrc = ''
+				console.log('previewVideoClose', this.previewVideoSrc)
+			},
+			imgDel(index) {
+				let that = this
+				that.$util.confirmModal({content:'确认删除?'},() => {
+					// that.uploadLists.splice(index, 1)
+					// that.$emit("input", that.uploadLists);
+					// that.$emit("imgDelete", that.uploadLists);
+					let delUrl = that.uploadLists[index]
+					that.uploadLists.splice(index, 1)
+					that.$emit("input", that.uploadLists);
+					that.$emit("imgDelete", {
+						del: delUrl,
+						tempFilePaths: that.uploadLists,
+						index:index
+					});					
+				})
+			},
+			imgPreview(index) {
+
+				var imgData = this.uploadLists.filter(item => /.(gif|jpg|jpeg|png|gif|jpg|png)/i.test(item)) //只预览图片的
+				uni.previewImage({
+					urls: imgData,
+					current: index,
+					loop: true,
+				});
+
+
+			},
+			chooseFile() {
+				if (this.disabled) {
+					return false;
+				}
+				switch (this.mediaTypeData.indexOf(this.mediaType)) {
+					case 1: //视频
+						this.videoAdd();
+						break;
+					case 2: //全部
+						uni.showActionSheet({
+							itemList: ['相册', '视频'],
+							success: (res) => {
+								if (res.tapIndex == 1) {
+									this.videoAdd();
+								} else if (res.tapIndex == 0) {
+									this.imgAdd();
+								}
+							},
+							fail: (res) => {
+								console.log(res.errMsg);
+							}
+						});
+						break;
+					default: //图片
+						this.imgAdd();
+						break;
+				}
+
+
+				//if(this.mediaType=='image'){
+
+
+			},
+			videoAdd() {
+				console.log('videoAdd')
+				let nowNum = Math.abs(this.uploadLists.length - this.max);
+				let thisNum = (this.chooseNum > nowNum ? nowNum : this.chooseNum) //可选数量
+				uni.chooseVideo({
+					compressed: this.compress,
+					sourceType: this.sourceType,
+					camera: this.camera,
+					maxDuration: this.maxDuration,
+					success: (res) => {
+						console.log('videoAdd', res)
+						console.log(res.tempFilePath)
+						this.chooseSuccessMethod([res.tempFilePath], 1)
+						//this.imgUpload([res.tempFilePath]);
+						//console.log('tempFiles', res)
+						// if (this.action == '') { //未配置上传路径
+						// 	this.$emit("chooseSuccess", res.tempFilePaths);
+						// } else {
+						// 	if (this.compress && (res.tempFiles[0].size / 1024 > 1025)) { //设置了需要压缩 并且 文件大于1M,进行压缩上传
+						// 		this.imgCompress(res.tempFilePaths);
+						// 	} else {
+						// 		this.imgUpload(res.tempFilePaths);
+						// 	}
+						// }
+					}
+				});
+			},
+			imgAdd() {
+				console.log('imgAdd')
+				let nowNum = Math.abs(this.uploadLists.length - this.max);
+				let thisNum = (this.chooseNum > nowNum ? nowNum : this.chooseNum) //可选数量
+				console.log('nowNum', nowNum)
+				console.log('thisNum', thisNum)
+				// #ifdef APP-PLUS
+				if (this.sourceType.length > 1) {
+					uni.showActionSheet({
+						itemList: ['拍摄', '从手机相册选择'],
+						success: (res) => {
+							if (res.tapIndex == 1) {
+								this.appGallery(thisNum);
+							} else if (res.tapIndex == 0) {
+								this.appCamera();
+							}
+						},
+						fail: (res) => {
+							console.log(res.errMsg);
+						}
+					});
+				}
+				if (this.sourceType.length == 1 && this.sourceType.indexOf('album') > -1) {
+					this.appGallery(thisNum);
+				}
+
+				if (this.sourceType.length == 1 && this.sourceType.indexOf('camera') > -1) {
+					this.appCamera();
+				}
+				// #endif
+				//#ifndef APP-PLUS
+				uni.chooseImage({
+					count: thisNum,
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: this.sourceType,
+					success: (res) => {
+						this.chooseSuccessMethod(res.tempFilePaths, 0)
+						//console.log('tempFiles', res)
+						// if (this.action == '') { //未配置上传路径
+						// 	this.$emit("chooseSuccess", res.tempFilePaths);
+						// } else {
+						// 	if (this.compress && (res.tempFiles[0].size / 1024 > 1025)) { //设置了需要压缩 并且 文件大于1M,进行压缩上传
+						// 		this.imgCompress(res.tempFilePaths);
+						// 	} else {
+						// 		this.imgUpload(res.tempFilePaths);
+						// 	}
+						// }
+					}
+				});
+				// #endif
+			},
+			appCamera() {
+				var cmr = plus.camera.getCamera();
+				var res = cmr.supportedImageResolutions[0];
+				var fmt = cmr.supportedImageFormats[0];
+				//console.log("Resolution: " + res + ", Format: " + fmt);
+				cmr.captureImage((path) => {
+						//alert("Capture image success: " + path);
+						this.chooseSuccessMethod([path], 0)
+					},
+					(error) => {
+						//alert("Capture image failed: " + error.message);
+						console.log("Capture image failed: " + error.message)
+					}, {
+						resolution: res,
+						format: fmt
+					}
+				);
+			},
+			appGallery(maxNum) {
+				plus.gallery.pick((res) => {
+					this.chooseSuccessMethod(res.files, 0)
+				}, function(e) {
+					//console.log("取消选择图片");
+				}, {
+					filter: "image",
+					multiple: true,
+					maximum: maxNum
+				});
+			},
+			chooseSuccessMethod(filePaths, type) {
+				if (this.action == '') { //未配置上传路径
+					this.$emit("chooseSuccess", filePaths, type); //filePaths 路径 type 0 为图片 1为视频
+				} else {
+					if (type == 1) {
+						this.imgUpload(filePaths);
+					} else {
+						if (this.compress) { //设置了需要压缩
+							this.imgCompress(filePaths);
+						} else {
+							this.imgUpload(filePaths);
+						}
+					}
+
+				}
+			},
+			imgCompress(tempFilePaths) {
+				uni.showLoading({
+					title: '压缩中...'
+				});
+
+				let compressImgs = [];
+				let results = [];
+				tempFilePaths.forEach((item, index) => {
+					compressImgs.push(new Promise((resolve, reject) => {
+						// #ifndef H5
+						uni.compressImage({
+							src: item,
+							quality: this.quality,
+							success: res => {
+								//console.log('compressImage', res.tempFilePath)
+								results.push(res.tempFilePath);
+								resolve(res.tempFilePath);
+							},
+							fail: (err) => {
+								//console.log(err.errMsg);
+								reject(err);
+							},
+							complete: () => {
+								//uni.hideLoading();
+							}
+						})
+						// #endif
+						// #ifdef H5
+						this.canvasDataURL(item, {
+							quality: this.quality / 100
+						}, (base64Codes) => {
+							//this.imgUpload(base64Codes);
+							results.push(base64Codes);
+							resolve(base64Codes);
+						})
+						// #endif
+					}))
+				})
+				Promise.all(compressImgs) //执行所有需请求的接口
+					.then((results) => {
+						uni.hideLoading();
+						console.log('imgUpload', results)
+						this.imgUpload(results);
+					})
+					.catch((res, object) => {
+						uni.hideLoading();
+					});
+			},
+			imgUpload(tempFilePaths) {
+				// if (this.action == '') {
+				// 	uni.showToast({
+				// 		title: '未配置上传地址',
+				// 		icon: 'none',
+				// 		duration: 2000
+				// 	});
+				// 	return false;
+				// }
+				uni.showLoading({
+					title: '上传中'
+				});
+				console.log('imgUpload', tempFilePaths)
+				let uploadImgs = [];
+				tempFilePaths.forEach((item, index) => {
+					uploadImgs.push(new Promise((resolve, reject) => {
+						console.log(index, item)
+						const uploadTask = uni.uploadFile({
+							url: this.action, //仅为示例,非真实的接口地址
+							filePath: item,
+							name: this.name,
+							fileType: 'image',
+							formData: this.formData,
+							header: this.headers,
+							success: (uploadFileRes) => {
+								if (typeof this.uploadSuccess == 'function') {
+									if (this.uploadSuccess(uploadFileRes).success) {
+										this.value.push(this.uploadSuccess(uploadFileRes)
+											.url)
+										this.$emit("input", this.uploadLists);
+									}
+								}
+								resolve(uploadFileRes);
+								this.$emit("uploadSuccess", uploadFileRes);
+							},
+							fail: (err) => {
+								console.log(err);
+								//uni.hideLoading();
+								reject(err);
+								this.$emit("uploadFail", err);
+							},
+							complete: () => {
+								//uni.hideLoading();
+							}
+						});
+					}))
+				})
+				Promise.all(uploadImgs) //执行所有需请求的接口
+					.then((results) => {
+						uni.hideLoading();
+					})
+					.catch((res, object) => {
+						uni.hideLoading();
+						this.$emit("uploadFail", res);
+					});
+				// uploadTask.onProgressUpdate((res) => {
+				// 	//console.log('',)
+				// 	uni.showLoading({
+				// 		title: '上传中' + res.progress + '%'
+				// 	});
+				// 	if (res.progress == 100) {
+				// 		uni.hideLoading();
+				// 	}
+				// });
+			},
+			canvasDataURL(path, obj, callback) {
+				var img = new Image();
+				img.src = path;
+				img.onload = function() {
+					var that = this;
+					// 默认按比例压缩
+					var w = that.width,
+						h = that.height,
+						scale = w / h;
+					w = obj.width || w;
+					h = obj.height || (w / scale);
+					var quality = 0.8; // 默认图片质量为0.8
+					//生成canvas
+					var canvas = document.createElement('canvas');
+					var ctx = canvas.getContext('2d');
+					// 创建属性节点
+					var anw = document.createAttribute("width");
+					anw.nodeValue = w;
+					var anh = document.createAttribute("height");
+					anh.nodeValue = h;
+					canvas.setAttributeNode(anw);
+					canvas.setAttributeNode(anh);
+					ctx.drawImage(that, 0, 0, w, h);
+					// 图像质量
+					if (obj.quality && obj.quality <= 1 && obj.quality > 0) {
+						quality = obj.quality;
+					}
+					// quality值越小,所绘制出的图像越模糊
+					var base64 = canvas.toDataURL('image/jpeg', quality);
+					// 回调函数返回base64的值
+					callback(base64);
+				}
+			},
+		}
+	}
+</script>
+
+<style>
+	.preview-full {
+		position: fixed;
+		top: 0;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		height: 100%;
+		z-index: 1002;
+	}
+
+	.preview-full video {
+		width: 100%;
+		height: 100%;
+		z-index: 1002;
+	}
+
+	.preview-full-close {
+		position: fixed;
+		right: 32rpx;
+		top: 25rpx;
+		width: 80rpx;
+		height: 80rpx;
+		line-height: 60rpx;
+		text-align: center;
+		z-index: 1003;
+		/* 	background-color: #808080; */
+		color: #fff;
+		font-size: 65rpx;
+		font-weight: bold;
+		text-shadow: 1px 2px 5px rgb(0 0 0);
+	}
+
+
+
+	/* .preview-full-close-before,
+	.preview-full-close-after {
+		position: absolute;
+		top: 50%;
+		left: 50%;
+		content: '';
+		height: 60rpx;
+		margin-top: -30rpx;
+		width: 6rpx;
+		margin-left: -3rpx;
+		background-color: #FFFFFF;
+		z-index: 20000;
+	}
+
+	.preview-full-close-before {
+		transform: rotate(45deg);
+
+	}
+
+	.preview-full-close-after {
+		transform: rotate(-45deg);
+
+	} */
+
+	.htz-image-upload-list {
+		display: flex;
+		flex-wrap: wrap;
+	}
+
+	.htz-image-upload-Item {
+		width: 160rpx;
+		height: 160rpx;
+		margin: 13rpx;
+		border-radius: 10rpx;
+		position: relative;
+	}
+
+	.htz-image-upload-Item image {
+		width: 100%;
+		height: 100%;
+		border-radius: 10rpx;
+	}
+
+	.htz-image-upload-Item-video {
+		width: 100%;
+		height: 100%;
+		border-radius: 10rpx;
+		position: relative;
+
+	}
+
+	.htz-image-upload-Item-video-fixed {
+		position: absolute;
+		top: 0;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		height: 100%;
+		border-radius: 10rpx;
+		z-index: 996;
+
+	}
+
+	.htz-image-upload-Item video {
+		width: 100%;
+		height: 100%;
+		border-radius: 10rpx;
+
+	}
+
+	.htz-image-upload-Item-add {
+		font-size: 105rpx;
+		/* line-height: 160rpx; */
+		text-align: center;
+		border: 1px dashed #d9d9d9;
+		color: #d9d9d9;
+	}
+
+	.htz-image-upload-Item-del {
+		background-color: #f5222d;
+		font-size: 24rpx;
+		position: absolute;
+		width: 35rpx;
+		height: 35rpx;
+		line-height: 35rpx;
+		text-align: center;
+		top: 0;
+		right: 0;
+		z-index: 997;
+		color: #fff;
+	}
+
+	.htz-image-upload-Item-del-cover {
+		background-color: #f5222d;
+		font-size: 24rpx;
+		position: absolute;
+		width: 35rpx;
+		height: 35rpx;
+		text-align: center;
+		top: 0;
+		right: 0;
+		color: #fff;
+		/* #ifdef APP-PLUS */
+		line-height: 25rpx;
+		/* #endif */
+		/* #ifndef APP-PLUS */
+		line-height: 35rpx;
+		/* #endif */
+		z-index: 997;
+
+	}
+</style>

+ 452 - 0
hdApp/src/admin/goodsManage/detail.vue

@@ -0,0 +1,452 @@
+<template>
+  <view class="app-content">
+    <form @submit="formSubmit">
+      <view class="module-com input-line-wrap">
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title required">名称</view>
+          <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="text" />
+        </tui-list-cell>
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title required">价格</view>
+          <input v-model="form.price" placeholder-class="phcolor" class="tui-input" name="price" placeholder="请输入" maxlength="50" type="digit" />
+        </tui-list-cell>
+        <tui-list-cell class="line-cell category-wrap" :hover="false">
+          <view class="tui-title">分类</view>
+          <view class="tui-input">
+            <block v-for="(item, index) in categoryData" :key="index">
+              <button
+                class="admin-button-com"
+                :class="[(form.categoryIdList.includes(item.id + '')||form.categoryIdList.includes(item.id*1)) ? '' : 'default']"
+                @click="selCategoryFn(item)"
+              >{{ item.categoryName || '暂无' }}</button>
+            </block>
+          </view>
+        </tui-list-cell>
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">库存</view>
+          <input v-model="form.stock" placeholder-class="phcolor" class="tui-input" disabled="true" name="stock" placeholder="留空表示库存充足" maxlength="50" type="number" />
+        </tui-list-cell>
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">历史销量</view>
+          <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">
+          <view class="tui-title">节日涨价</view>
+          <label for="autoPrice" class="tui-input" @click="autoRiseChange(form.autoRise)">
+            <checkbox id="autoPrice" class="ljd-checkbox" :checked="form.autoRise == 1" style="transform: scale(0.7,0.7);" ></checkbox>
+            <span>需要</span>
+          </label>
+        </tui-list-cell>
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">配送方式</view>
+          <label for="sendType" class="tui-input" @click="needSendChange(form.needSend)">
+            <checkbox id="sendType" class="ljd-checkbox" :checked="form.needSend == 1" @change="giftChange" style="transform: scale(0.7,0.7);" ></checkbox>
+            <span>仅自取</span>
+          </label>
+        </tui-list-cell>
+
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">运费</view>
+          <radio-group class="tui-input" @change="freightChange">
+            <label class="list" for="customLink">
+              <radio id="customLink" value="0" :checked="form.freightType == 0" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">按距离收费</span>
+            </label>
+            <label class="list" for="goodsLink">
+              <radio id="goodsLink" value="1" :checked="form.freightType == 1" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">免运费</span>
+            </label>
+          </radio-group>
+        </tui-list-cell>
+
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">状态</view>
+          <radio-group class="tui-input" @change="statusChange">
+            <label class="list" for="upLink">
+              <radio id="upLink" value="1" :checked="form.status == 1" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">上架</span>
+            </label>
+            <label class="list" for="downLink">
+              <radio id="downLink" value="0" :checked="form.status == 0" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">下架</span>
+            </label>
+          </radio-group>
+        </tui-list-cell>
+
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">属性</view>
+          <radio-group class="tui-input" @change="flowerChange">
+            <label class="list" for="flowerLink">
+              <radio id="flowerLink" value="1" :checked="form.flower == 1" :disabled="option.id && Number(option.id)>0 ? true : false" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">鲜花类</span>
+            </label>
+            <label class="list" for="plantsLink">
+              <radio id="plantsLink" value="0" :checked="form.flower == 0" :disabled="option.id && Number(option.id)>0 ? true : false" style="transform: scale(0.8,0.8);" />
+              <span class="checkbox-text">绿植盆栽资材</span>
+            </label>
+          </radio-group>
+        </tui-list-cell>
+
+        <tui-list-cell class="line-cell" :hover="false" v-if="form.flower == 1">
+          <view class="tui-title">支数</view>
+          <input v-model="form.flowerNum" placeholder-class="phcolor" class="tui-input" name="sold" placeholder="支数" maxlength="50" type="number" />
+        </tui-list-cell>
+      </view>
+
+      <view class="module-com content-box proInfo" v-if="form.flower == 1">
+        <view class="commodity-view">
+          <view class="infoAEdit">
+            <text>使用花材</text>
+          </view>
+          <view class="commodity-list">
+            <view v-for="(s, idx) in goodsInfo.goodsItem" :key="idx" class="commodity-item" >
+              <image class="item-icon" :src="s.smallCover" @click="pageTo({url:'/admin/item/detail',query:{id: s.id}})" />
+              <view class="item-info">
+                <view class="info-line">
+                  <text class="item-name">{{ s.name }}</text>
+                  <text class="item-price">
+                    <text class="unit"></text>
+                    <text class="price">
+                      <text>{{s.num}}{{s.unitName}}</text>
+                    </text>
+                  </text>
+                </view>
+              </view>
+            </view>
+          </view>
+          <view class="summary-bar">
+            <view class="operate-view"></view>
+            <view class="describe-view">共<text v-if="Number(goodsInfo.bigNum)>0">{{goodsInfo.bigNum}}扎</text><text v-if="Number(goodsInfo.smallNum)>0">{{goodsInfo.smallNum}}支</text></view>
+          </view>
+        </view>
+      </view>
+
+      <view class="module-com input-line-wrap goods-wrap">
+        <view class="module-tit">
+          <span>图片</span>
+          <span class="app-color-3">(最多4张)</span>
+        </view>
+        <view class="module-det">
+          <htz-image-upload :max="4" :compress="true" v-model="currentImgData" :headers="headers"
+           @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
+          </htz-image-upload>
+        </view>
+      </view>
+
+      <view class="module-com input-line-wrap summary-wrap">
+        <view class="module-tit">简介</view>
+        <view class="module-det" style="padding-bottom: 10upx">
+          <textarea v-model="form.briefContent" class="goods-summary" placeholder-class="phcolor" placeholder="请输入简介" />
+        </view>
+      </view>
+
+      <view class="app-footer">
+        <button class="admin-button-com middle default" @click="goBack">取消</button>
+        <button class="admin-button-com middle blue" formType="submit">保存</button>
+      </view>
+    </form>
+  </view>
+</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");
+import { getCategory } from "@/utils/config";
+import { getDetailB, addB, updateB } from "@/api/goods";
+//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
+import htzImageUpload from './components/htz-image-upload/htz-image-upload.vue'
+export default {
+  name: "add",
+  components: {
+    TuiListCell,
+    AppUploader,
+    htzImageUpload
+  },
+  data() {
+    return {
+      headers:{token:''},
+      currentImgData: [],
+      status: 1,
+      goodsInfo:[],
+      form: {
+        id:0,
+        name: "",
+        stock: "",
+        price: "",
+        categoryIdList: [],
+        autoRise: "1",
+        needSend: "0",
+        freightType: "0",
+        shopImg: [],
+        briefContent: "",
+        status:1,
+        flower:1,
+        flowerNum:0
+      }
+    };
+  },
+  computed: {
+    ...mapGetters({ categoryData: "getCategory" })
+  },
+  onLoad() {
+    const token = uni.getStorageSync('token')
+    this.headers.token = token
+  },
+  watch:{
+  },
+  methods: {
+    imgDeleteFn(res){
+      const index = res.index
+      this.form.shopImg.splice(index,1)
+    },
+    imgUploadSuccess(res) {
+      var _res = JSON.parse(res.data)
+      if(_res.code == 1){
+        this.currentImgData.push(_res.data.smallUrl)
+        this.form.shopImg.push(_res.data.shortUrl)
+      }
+    },
+    goBack(){
+      uni.navigateBack({delta:1})
+    },
+    init() {
+      getCategory().then(() => {
+          this.getDetail()
+      })
+    },
+    getDetail() {
+      return getDetailB({ id: this.option.id }) .then(res => {
+        if (this.$util.isEmpty(res.data)) {
+          return;
+        }
+        this.goodsInfo = res.data
+        console.log(this.goodsInfo,'1111')
+        Object.keys(this.form).forEach((i, index) => {
+          this.form[i] = res.data[i];
+        });
+        this.form.sold = res.data.sold
+        this.currentImgData = res.data.smallImgList
+        this.form.shopImg = res.data.shortImgList
+      })
+    },
+    formSubmit(e) {
+      let rules = [
+        {
+          name: "name",
+          rule: ["required"],
+          msg: ["请输入名称"]
+        },
+        {
+          name: "price",
+          rule: ["required"],
+          msg: ["请输入价格"]
+        }
+      ];
+      let formData = e.detail.value;
+      let checkRes = form.validation(formData, rules);
+      if (!checkRes) {
+        setTimeout(() => {
+          this.confirmFn();
+        });
+      } else {
+        this.$msg(checkRes);
+      }
+    },
+    confirmFn() {
+      if (this.form.categoryIdList == 0) {
+        this.$msg("请选择分类")
+        return false
+      }
+      if (this.$util.isEmpty(this.form.shopImg)) {
+        this.$msg("请上传图片")
+        return false
+      }
+      let host = this.option.id ? updateB : addB;
+      let form = JSON.parse(JSON.stringify(this.form))
+      host({ ...form }).then(res => {
+        uni.navigateBack({})
+        this.$msg("操作成功")
+      });
+    },
+    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);
+      }
+    },
+    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;
+    },
+    flowerChange(e){
+      if(this.option.id && Number(this.option.id)>0){
+        this.$msg('不可修改')
+        return false
+      }
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.app-content {
+  min-height: calc(100vh - 100upx);
+  padding-bottom: 100upx;
+}
+.module-com {
+  margin-bottom: 20upx;
+  background-color: #fff;
+  color: $fontColor2;
+  .module-tit {
+    padding: 20upx 30upx;
+    font-size: 28upx;
+  }
+  .module-det {
+    padding: 0 30upx;
+  }
+}
+.category-wrap {
+  align-items: flex-start;
+  padding-bottom: 0 !important;
+  .tui-input {
+    @include disFlex(center, flex-start);
+    flex-wrap: wrap;
+    .admin-button-com {
+      margin-right: 20upx;
+      margin-bottom: 20upx;
+      position: relative;
+      z-index: 9999;
+    }
+  }
+}
+.summary-wrap {
+  .goods-summary {
+    height: 300upx;
+  }
+}
+.app-footer {
+  justify-content: space-evenly;
+  z-index: 9999;
+  .admin-button-com {
+    width: 46%;
+    padding-top:30upx;
+    padding-bottom:30upx;
+  }
+}
+  .commodity-view {
+    display: flex;
+    flex-direction: column;
+    .commodity-list {
+      padding: 25upx;
+      .commodity-item {
+        display: flex;
+        margin-bottom: 20upx;
+        .item-icon {
+          flex-shrink: 0;
+          width: 120upx;
+          height: 120upx;
+        }
+        .item-info {
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          flex: 1;
+          margin-left: 20upx;
+          .info-line {
+            margin-bottom: 20upx;
+            display: flex;
+            justify-content: space-between;
+            align-items: flex-end;
+            .item-name {
+              color: black;
+              font-size: 30upx;
+              font-weight: 700;
+							overflow: hidden;
+							white-space: nowrap;
+							text-overflow: ellipsis;
+							width:360upx;
+            }
+            .item-price {
+              padding-right:30upx;
+              color: #333;
+              .price {
+                font-size: 28upx;
+              }
+            }
+            .item-type {
+              color: #999;
+              font-size: 24upx;
+            }
+            .item-count {
+              color: #666;
+              font-size: 24upx;
+            }
+          }
+        }
+      }
+    }
+    .summary-bar {
+      padding: 0 20upx;
+      height: 90upx;
+      display: flex;
+
+      align-items: center;
+      justify-content: space-between;
+      border-top: 1px solid #eeeeee;
+      .operate-view {
+        display: flex;
+
+        align-items: center;
+        color: #3385ff;
+        font-size: 26upx;
+        .iconfont {
+          margin-right: 20upx;
+          font-size: 40upx;
+        }
+      }
+      .describe-view {
+        display: flex;
+
+        align-items: center;
+        color: #333;
+        font-size: 24upx;
+        .price {
+          font-weight: bold;
+          font-size: 30upx;
+        }
+      }
+    }
+  }
+.infoAEdit {
+  display: flex;
+  justify-content: space-between;
+  height: 60upx;
+  line-height: 80upx;
+  font-size: 28;
+  font-weight: 700;
+  color: #666;
+  padding: 0 20upx;
+  .iconfont {
+    margin-right: 15upx;
+    font-size: 30upx;
+  }
+  & > .editFlr {
+    position: relative;
+    color: #1890f3;
+    font-size: 26upx;
+    &:after {
+      content: "";
+      position: absolute;
+      left: 0;
+      top: 0;
+    }
+  }
+}
+</style>

+ 11 - 26
hdApp/src/admin/goodsManage/list.vue

@@ -7,7 +7,7 @@
         </view>
       </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" >
+        <scroll-view scroll-y class="right-box" v-if="currentTab==index" >
           <block v-if="!$util.isEmpty(list.data)">
             <view class="page-view">
               <view class="goods-list" v-for="(goodsItem, idx) in list.data" :key="idx">
@@ -31,25 +31,21 @@
                   </view>
                 </view>
                 <view class="goods-list-bottom flex-center-between">
-                  <text @click.stop="edit(goodsItem.id)">编辑</text>
-                  <text @click.stop="">库存明细</text>
                   <text @click.stop="">销售记录</text>
+                  <text @click.stop="">库存明细</text>
+                  <text @click.stop="edit(goodsItem.id)">编辑</text>
                 </view>
               </view>
             </view>
-
           </block>
           <block v-else>
             <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
           </block>
-
         </scroll-view>
       </block>
     </view>
-
   </view>
 </template>
-
 <script>
 import OperateModule from "@/admin/home/components/module/operate";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
@@ -97,7 +93,7 @@ export default {
   },
   methods: {
     edit(id){
-        this.$util.pageTo({ url: "/admin/goodsManage/add", query: { id: id } })
+        this.$util.pageTo({ url: "/admin/goodsManage/detail", query: { id: id } })
     },
     async sInit() {
       this._getClass();
@@ -155,7 +151,6 @@ export default {
   }
 };
 </script>
-
 <style lang="scss" scoped>
 .app-content {
   min-height: calc(100vh - 80upx);
@@ -164,19 +159,13 @@ export default {
 page {
   background: #fff;
 }
-
-/* 左侧导航布局 start*/
-
-/* 隐藏scroll-view滚动条*/
-
 ::-webkit-scrollbar {
   width: 0;
   height: 0;
   color: transparent;
 }
-
 .tab-view {
-  height:1210upx;
+  height:1500upx;
   width: 200upx;
   position: fixed;
   left: 0;
@@ -194,14 +183,12 @@ page {
     color: #444;
     font-weight: 400;
   }
-
   .active {
     position: relative;
     color: $mainColor;
     font-size: 26upx;
     background: #fff;
   }
-
   .active::before {
     content: "";
     position: absolute;
@@ -210,13 +197,12 @@ page {
     left: 0;
   }
 }
-
-/* 左侧导航布局 end*/
-
 .right-box {
   width: 100%;
+  height:1260upx;
   position: fixed;
   padding-left: 220upx;
+  padding-bottom:30upx;
   box-sizing: border-box;
   left: 0;
   .page-view {
@@ -233,12 +219,12 @@ page {
       .goods-list-bottom {
         width: 96%;
         margin-top: 16upx;
-        color: #CCCCCC;
+        color: #bebebe;
         text{
-          border:1px solid #ccc;
+          border:1px solid rgb(218, 216, 216);
           border-radius: 20upx;
-          font-size:20upx;
-          padding:7upx 25upx 7upx 25upx;
+          font-size:22upx;
+          padding:6upx 25upx 6upx 25upx;
         }
       }
       .img-blo {
@@ -274,7 +260,6 @@ page {
     }
   }
 }
-// 底部
 .app-footer {
   justify-content: space-between;
   .btn-list {

+ 38 - 38
hdApp/src/admin/item/add.vue

@@ -1,21 +1,21 @@
 <template>
-  <div class="app-content">
+  <view class="app-content">
     <!-- 花材基本信息 -->
     <form @submit="formSubmit">
-      <div class="module-com input-line-wrap">
+      <view class="module-com input-line-wrap">
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">花材名称</div>
+          <view class="tui-title">花材名称</view>
           <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写名称" @input="fillName($event)" maxlength="50" type="text" />
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">花材品种</div>
+          <view class="tui-title">花材品种</view>
           <view style="color:red;width:450upx;height:45upx;" @click.stop="notModify">{{form.name}}</view>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">拼音缩写</div>
+          <view class="tui-title">拼音缩写</view>
           <input
             v-model="form.py"
             placeholder-class="phcolor"
@@ -28,7 +28,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">售价</div>
+          <view class="tui-title">售价</view>
           <input
             v-model="form.price"
             placeholder-class="phcolor"
@@ -42,7 +42,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">今日特价</div>
+          <view class="tui-title">今日特价</view>
           <input
             v-model="form.discountPrice"
             placeholder-class="phcolor"
@@ -56,13 +56,13 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">库存</div>
+          <view class="tui-title">库存</view>
           <input v-model="form.stock" style="width:340upx;" placeholder-class="phcolor" @focus="form.stock=''" @input="changeStock($event)" class="tui-input" name="stock" placeholder="请输入" type="digit"/>
           <button v-if="productData.id > 0" class="admin-button-com blue small" @click="goStockDetail(productData.id)">库存明细</button>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">分类</div>
+          <view class="tui-title">分类</view>
           <picker
             mode="selector"
             :value="form.classId"
@@ -72,13 +72,13 @@
             class="tui-input"
           >
             <input v-model="form.classId" name="classId" type="text" hidden />
-            <div v-if="form.classId" style="height:45upx;" >{{ itemClassSelectedData.name }}</div>
-            <div class="tui-placeholder" style="height:45upx;" v-else>请选择</div>
+            <view v-if="form.classId" style="height:45upx;" >{{ itemClassSelectedData.name }}</view>
+            <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view>
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">大单位</div>
+          <view class="tui-title">大单位</view>
           <picker
             mode="selector"
             :value="form.bigUnitId"
@@ -88,13 +88,13 @@
             class="tui-input"
           >
             <input v-model="form.bigUnitId" name="bigUnitId" type="text" hidden />
-            <div v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</div>
-            <div class="tui-placeholder" style="height:45upx;" v-else>请选择</div>
+            <view v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</view>
+            <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view>
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">小单位</div>
+          <view class="tui-title">小单位</view>
           <picker
             mode="selector"
             :value="form.smallUnitId"
@@ -104,13 +104,13 @@
             class="tui-input"
           >
             <input v-model="form.smallUnitId" name="smallUnitId" type="text" hidden />
-            <div v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</div>
-            <div class="tui-placeholder" v-else>请选择</div>
+            <view v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</view>
+            <view class="tui-placeholder" v-else>请选择</view>
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">散客加价</div>
+          <view class="tui-title">散客加价</view>
           <input
             v-model="form.skAddPrice"
             placeholder-class="phcolor"
@@ -123,7 +123,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">普店加价</div>
+          <view class="tui-title">普店加价</view>
           <input
             v-model="form.addPrice"
             placeholder-class="phcolor"
@@ -136,7 +136,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">银店加价</div>
+          <view class="tui-title">银店加价</view>
           <input
             v-model="form.hjAddPrice"
             placeholder-class="phcolor"
@@ -149,7 +149,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">金店加价</div>
+          <view class="tui-title">金店加价</view>
           <input
             v-model="form.zsAddPrice"
             placeholder-class="phcolor"
@@ -163,7 +163,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">单位比</div>
+          <view class="tui-title">单位比</view>
           <input
             v-model="form.ratio"
             placeholder-class="phcolor"
@@ -176,7 +176,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">每扎重量</div>
+          <view class="tui-title">每扎重量</view>
           <input
             v-model="form.weight"
             placeholder-class="phcolor"
@@ -189,7 +189,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">库存预警值</div>
+          <view class="tui-title">库存预警值</view>
           <input
             v-model="form.stockWarning"
             placeholder-class="phcolor"
@@ -202,45 +202,45 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">上架状态</div>
-          <div class="switch_bx">
+          <view class="tui-title">上架状态</view>
+          <view class="switch_bx">
             <switch :checked="form.status == 2 ? false : true" @change="statusChange" style="transform: scale(0.8,0.8)" />
             <text v-if="form.status == 1">上架</text>
             <text v-else>下架</text>
-          </div>
+          </view>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">状态</div>
-          <div class="switch_bx">
+          <view class="tui-title">状态</view>
+          <view class="switch_bx">
             <switch :checked="form.delStatus == 0 ? true : false" @change="delStatusChange" style="transform: scale(0.8,0.8)" />
             <text v-if="form.delStatus == 0">启用</text>
             <text v-else>停用</text>
-          </div>
+          </view>
         </tui-list-cell>
 
-      </div>
+      </view>
 
-      <div class="module-com input-line-wrap goods-wrap">
-        <div class="module-tit">
+      <view class="module-com input-line-wrap goods-wrap">
+        <view class="module-tit">
           <span>花材图片</span>
           <span class="app-color-3">(建议比例 600X600)</span>
-        </div>
+        </view>
         <view class="module-det">
           <htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
            @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
           </htz-image-upload>
         </view>
-      </div>
+      </view>
 
-      <div class="app-footer">
+      <view class="app-footer">
         <button class="admin-button-com big default" @click="goBack()">取消</button>
         <button v-if="option.ptItemId" class="admin-button-com big blue" formType="submit" @click="status = 1">添加</button>
         <button v-else class="admin-button-com big blue" formType="submit" @click="status = 1">确认</button>
-      </div>
+      </view>
 
     </form>
-  </div>
+  </view>
 </template>
 
 <script>

+ 0 - 2
hdApp/src/admin/item/components/htz-image-upload/htz-image-upload.vue

@@ -26,8 +26,6 @@
 			</video>
 		</view>
 
-
-		<!--  -->
 	</view>
 </template>
 

+ 39 - 39
hdApp/src/admin/item/detail.vue

@@ -1,21 +1,21 @@
 <template>
-  <div class="app-content">
+  <view class="app-content">
     <!-- 花材基本信息 -->
     <form @submit="formSubmit">
-      <div class="module-com input-line-wrap">
+      <view class="module-com input-line-wrap">
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">花材名称</div>
+          <view class="tui-title">花材名称</view> 
           <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写名称" @input="fillName($event)" maxlength="50" type="text" />
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">花材品种</div>
+          <view class="tui-title">花材品种</view> 
           <view style="color:red;width:450upx;height:45upx;" @click.stop="notModify">{{productData.ptItemInfo ? productData.ptItemInfo.name : ''}}</view>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">拼音缩写</div>
+          <view class="tui-title">拼音缩写</view> 
           <input
             v-model="form.py"
             placeholder-class="phcolor"
@@ -28,7 +28,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">售价</div>
+          <view class="tui-title">售价</view> 
           <input
             v-model="form.price"
             placeholder-class="phcolor"
@@ -42,7 +42,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">今日特价</div>
+          <view class="tui-title">今日特价</view> 
           <input
             v-model="form.discountPrice"
             placeholder-class="phcolor"
@@ -56,13 +56,13 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">库存</div>
+          <view class="tui-title">库存</view> 
           <input v-model="form.stock" style="width:340upx;" placeholder-class="phcolor" @focus="form.stock=''" @input="changeStock($event)" class="tui-input" name="stock" placeholder="请输入" type="digit"/>
           <button v-if="productData.id > 0" class="admin-button-com blue small" @click="goStockDetail(productData.id)">库存明细</button>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">分类</div>
+          <view class="tui-title">分类</view> 
           <picker
             mode="selector"
             :value="form.classId"
@@ -72,13 +72,13 @@
             class="tui-input"
           >
             <input v-model="form.classId" name="classId" type="text" hidden />
-            <div v-if="form.classId" style="height:45upx;" >{{ itemClassSelectedData.name }}</div>
-            <div class="tui-placeholder" style="height:45upx;" v-else>请选择</div>
+            <view v-if="form.classId" style="height:45upx;" >{{ itemClassSelectedData.name }}</view> 
+            <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view> 
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">大单位</div>
+          <view class="tui-title">大单位</view> 
           <picker
             mode="selector"
             :value="form.bigUnitId"
@@ -88,13 +88,13 @@
             class="tui-input"
           >
             <input v-model="form.bigUnitId" name="bigUnitId" type="text" hidden />
-            <div v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</div>
-            <div class="tui-placeholder" style="height:45upx;" v-else>请选择</div>
+            <view v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</view> 
+            <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view> 
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :arrow="true">
-          <div class="tui-title">小单位</div>
+          <view class="tui-title">小单位</view> 
           <picker
             mode="selector"
             :value="form.smallUnitId"
@@ -104,13 +104,13 @@
             class="tui-input"
           >
             <input v-model="form.smallUnitId" name="smallUnitId" type="text" hidden />
-            <div v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</div>
-            <div class="tui-placeholder" v-else>请选择</div>
+            <view v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</view> 
+            <view class="tui-placeholder" v-else>请选择</view> 
           </picker>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">散客加价</div>
+          <view class="tui-title">散客加价</view> 
           <input
             v-model="form.skAddPrice"
             placeholder-class="phcolor"
@@ -123,7 +123,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">普店加价</div>
+          <view class="tui-title">普店加价</view> 
           <input
             v-model="form.addPrice"
             placeholder-class="phcolor"
@@ -136,7 +136,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">银店加价</div>
+          <view class="tui-title">银店加价</view> 
           <input
             v-model="form.hjAddPrice"
             placeholder-class="phcolor"
@@ -149,7 +149,7 @@
           />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">金店加价</div>
+          <view class="tui-title">金店加价</view> 
           <input
             v-model="form.zsAddPrice"
             placeholder-class="phcolor"
@@ -163,7 +163,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">单位比</div>
+          <view class="tui-title">单位比</view> 
           <input
             v-model="form.ratio"
             placeholder-class="phcolor"
@@ -176,7 +176,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">零售价系数</div>
+          <view class="tui-title">零售价系数</view> 
           <input
             v-model="form.smallRatio"
             placeholder-class="phcolor"
@@ -189,7 +189,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">每扎重量</div>
+          <view class="tui-title">每扎重量</view> 
           <input
             v-model="form.weight"
             placeholder-class="phcolor"
@@ -202,7 +202,7 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">库存预警值</div>
+          <view class="tui-title">库存预警值</view> 
           <input
             v-model="form.stockWarning"
             placeholder-class="phcolor"
@@ -215,45 +215,45 @@
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">上架状态</div>
-          <div class="switch_bx">
+          <view class="tui-title">上架状态</view> 
+          <view class="switch_bx">
             <switch :checked="form.status == 2 ? false : true" @change="statusChange" style="transform: scale(0.8,0.8)" />
             <text v-if="form.status == 1">上架</text>
             <text v-else>下架</text>
-          </div>
+          </view> 
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <div class="tui-title">状态</div>
-          <div class="switch_bx">
+          <view class="tui-title">状态</view> 
+          <view class="switch_bx">
             <switch :checked="form.delStatus == 0 ? true : false" @change="delStatusChange" style="transform: scale(0.8,0.8)" />
             <text v-if="form.delStatus == 0">启用</text>
             <text v-else>停用</text>
-          </div>
+          </view> 
         </tui-list-cell>
 
-      </div>
+      </view> 
 
-      <div class="module-com input-line-wrap goods-wrap">
-        <div class="module-tit">
+      <view class="module-com input-line-wrap goods-wrap">
+        <view class="module-tit">
           <span>花材图片</span>
           <span class="app-color-3">(建议比例 600X600)</span>
-        </div>
+        </view> 
         <view class="module-det">
           <htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
            @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
           </htz-image-upload>
         </view>
-      </div>
+      </view> 
 
-      <div class="app-footer">
+      <view class="app-footer">
         <button class="admin-button-com big default" @click="goBack()">取消</button>
         <button v-if="option.ptItemId" class="admin-button-com big blue" formType="submit" @click="status = 1">添加</button>
         <button v-else class="admin-button-com big blue" formType="submit" @click="status = 1">确认</button>
-      </div>
+      </view> 
 
     </form>
-  </div>
+  </view> 
 </template>
 
 <script>

+ 1 - 1
hdApp/src/admin/item/list.vue

@@ -428,7 +428,7 @@ export default {
 		overflow: hidden;
 	}
 	.tab-view {
-		height: calc(100vh - 140upx);
+		height: calc(100vh - 100upx);
 		width: 170upx;
 		flex-shrink: 0;
 		background-color: #f0f2f6;

+ 6 - 0
hdApp/src/api/order/index.js

@@ -1,4 +1,10 @@
 import https from "@/plugins/luch-request_0.0.7/request";
+
+//损耗生成订单
+export const wastage = data => {
+	return https.post("/wastage/create-order", data);
+};
+
 /** *
  * 商城下单-生成订单 m
  */

+ 1 - 1
hdApp/src/pages.json

@@ -180,7 +180,7 @@
 			"pages": [
 				{ "path": "list", "style": { "navigationBarTitleText": "商品管理" } },
 				{ "path": "category", "style": { "navigationBarTitleText": "分类管理" } },
-				{ "path": "add", "style": { "navigationBarTitleText": "添加商品" } },
+				{ "path": "detail", "style": { "navigationBarTitleText": "商品详情" } },
 				{ "path": "img-store", "style": { "navigationBarTitleText": "图库管理" } },
 				{ "path": "goods-name", "style": { "navigationBarTitleText": "填写商品信息" } },
 				{ "path": "freight", "style": { "navigationBarTitleText": "运费设置" } },