Browse Source

Merge branch 'master' of http://git.jihengcc.cn/liubaiyan/qjd-user-uniapp

unknown 4 years ago
parent
commit
bc2f5a013f
3 changed files with 89 additions and 29 deletions
  1. 23 0
      components/CnumberBox.vue
  2. 32 23
      pagesGood/goodDetails.vue
  3. 34 6
      pagesGood/goodList.vue

+ 23 - 0
components/CnumberBox.vue

@@ -11,6 +11,7 @@
 		  :disabled="isDisabled"
 		  input-align="center"
 		  :custom-style="{width:'45px'}"/>
+		<input class="uni-input" v-model="number" :type="isInt?'number' : 'digit'" :disabled="isDisabled" :placeholder="placeholder" @input="onKeyInput" >
 		<uni-icons type="plus-filled" size="20" color="#A67A54" @click="numPlus"></uni-icons>
 	</view>
 </template>
@@ -21,6 +22,9 @@
 			isDisabled: {
 				default: false
 			},
+			isInt: {
+				default: true
+			},
 			placeholder: {
 				default: ''
 			},
@@ -37,6 +41,20 @@
 			}
 		},
 		methods: {
+			onKeyInput(event) {
+				// uniapp的input用这个
+				let i = event.target.value
+				// u-view的input用这个
+				// let i = event
+				let num = i.charAt(i.length-1)
+				var reg=new RegExp("^[0-9]*$")
+				if(!reg.test(num)) {
+					this.number =  i.slice(0,-1)
+				} else {
+					this.number = i
+				}
+				this.$emit('getNum',this.number);
+			},
 			numPlus() {
 			    this.number = Number(this.number) + Number(this.step)
 				this.$emit('getNum',this.number);
@@ -58,5 +76,10 @@
 		display: flex;
 		align-items: center;
 		justify-content: flex-end;
+		.uni-input {
+			height: 40px;
+			width: 45px;
+			text-align: center;
+		}
 	}
 </style>

+ 32 - 23
pagesGood/goodDetails.vue

@@ -208,30 +208,37 @@
 		},
 		onReady() {
 			this.getGoodsList()
-			if (this.goodId) {
-				NET.request(API.getCommonGoodDetail + '/' + this.goodId, {}, 'GET').then(res => {
-					this.goodData = res.data
-					if(this.goodData.sellDesc) this.goodData.sellDesc = this.goodData.sellDesc.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
-					if (this.goodData.productType == 2) {
-						this.getAuctionData()
-					}
-				}).catch(res => {
-					this.$refs.uTips.show({
-						title: '获取商品详情失败',
-						type: 'warning',
-					})
-				})
-				NET.request(API.getAssessList + this.goodId + '/1/3', {}, 'GET').then(res => {
-					this.assessList = res.data.list
-				}).catch(res => {
-					this.$refs.uTips.show({
-						title: '获取商品评价失败',
-						type: 'warning',
-					})
-				})
-			}
+			this.getGoodDetail()
 		},
 		methods: {
+			// 获取商品详情获取商品评价
+			getGoodDetail()	{
+				if (this.goodId) {
+					NET.request(API.getCommonGoodDetail + '/' + this.goodId, {}, 'GET').then(res => {
+						this.goodData = res.data
+						if (this.goodData.cartNum > 0) {
+							this.options[1].info = this.goodData.cartNum
+						}
+						if(this.goodData.sellDesc) this.goodData.sellDesc = this.goodData.sellDesc.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
+						if (this.goodData.productType == 2) {
+							this.getAuctionData()
+						}
+					}).catch(res => {
+						this.$refs.uTips.show({
+							title: '获取商品详情失败',
+							type: 'warning',
+						})
+					})
+					NET.request(API.getAssessList + this.goodId + '/1/3', {}, 'GET').then(res => {
+						this.assessList = res.data.list
+					}).catch(res => {
+						this.$refs.uTips.show({
+							title: '获取商品评价失败',
+							type: 'warning',
+						})
+					})
+				}
+			},
 			// 获取子组件的购买数量
 			getNum(num) {
 				this.number = num
@@ -334,8 +341,10 @@
 								title: '加入购物车成功',
 								type: 'success',
 							})
-							this.$refs.popup.close()
+							// this.$refs.popup.close()
+							this.getGoodDetail()
 						}).catch(error => {
+							console.log(error)
 							this.$refs.uTips.show({
 								title: '加入购物车失败',
 								type: 'warning',

+ 34 - 6
pagesGood/goodList.vue

@@ -1,15 +1,35 @@
 <template>
 	<view class="container">
 		<view v-if="goodType == 2" class="auction-main">
-			<view class="auction-title" @click="isOpen = !isOpen">拍卖说明
+			<view class="auction-title" @click="isOpen = !isOpen">拍卖规则
 			    <u-icon :name="isOpen?'arrow-up-fill':'arrow-down-fill'" color="#ffffff" style="margin-left:5px"></u-icon>
 			</view>
 			<view v-if="isOpen" class="auction-explain">
-				<p>1、竞买人必须具备本公司发布的公告或有关规定中注明的竞买条件,否则不得参加竞买。</p>
-				<p>2、竞买人必须具备本公司发布的公告或有关规定中注明的竞买条件,否则不得参加竞买。</p>
-				<p>3、竞买人必须具备本公司发布的公告或有关规定中注明的竞买条件,否则不得参加竞买。</p>
+				<span>特别注意:</span>
+				<p>本商城拍卖采用竞拍即付款的拍卖方式,每名会员每次拍卖仅能购买一件拍卖商品,同时根据拍卖商品的数量也可能会有多个会员竞拍成功。</p>
+				<span>关于退款:</span>
+				<p>会员出价如果已经不具有竞拍成功资质(也就是出价已经不是最高出价的几名会员之一时),则会立刻退还费用。同一会员多次出价会立刻退还上次出价的费用。</p>
+				<span>关于竞拍结果:</span>
+				<p>拍卖结束时,出价最高的几名会员竞拍成功,至多有"拍卖商品数量"个竞拍成功的会员。</p>
 			</view>
 		</view>
+		<!-- <u-collapse v-if="goodType == 2" :head-style="auctiontitle">
+			<u-collapse-item>
+				<view slot="title-all" class="auction-title" @click="isOpen = !isOpen">拍卖规则
+					<u-icon :name="isOpen?'arrow-up-fill':'arrow-down-fill'" color="#ffffff" style="margin-left:5px"></u-icon>
+				</view>
+				<view class="auction-main">
+					<view class="auction-explain">
+						<span>特别注意:</span>
+						<p>本商城拍卖采用竞拍即付款的拍卖方式,每名会员每次拍卖仅能购买一件拍卖商品,同时根据拍卖商品的数量也可能会有多个会员竞拍成功。</p>
+						<span>关于退款:</span>
+						<p>会员出价如果已经不具有竞拍成功资质(也就是出价已经不是最高出价的几名会员之一时),则会立刻退还费用。同一会员多次出价会立刻退还上次出价的费用。</p>
+						<span>关于竞拍结果:</span>
+						<p>拍卖结束时,出价最高的几名会员竞拍成功,至多有"拍卖商品数量"个竞拍成功的会员。</p>
+					</view>
+				</view>
+			</u-collapse-item>
+		</u-collapse> -->
 		<view class="search-box" v-if="goodsList.length">
 			<uni-search-bar ref="searchBar" radius="5" placeholder="搜索" :defaultText="goodName" clearButton="auto" cancelButton="none"
 			 bgColor="#ffffff" @confirm="search" class="search-bar" />
@@ -61,7 +81,14 @@
 				goodsList: [],
 				modalShow: false,
 				goodItem: {},
-				isOpen: false
+				isOpen: false,
+				auctiontitle: {
+					height: '35px',
+					background:'#52A63A',
+					color: '#FFFFFF',
+					'text-align': 'center',
+					padding: '5px',
+				}
 			}
 		},
 		onLoad(options) {
@@ -214,10 +241,11 @@
 			background:#52A63A;
 			color: #FFFFFF;
 			border-radius: 0 0 8px 8px;
-			text-align: center;
+			// text-align: center;
 			padding: 10px;
 			p {
 			  margin-bottom: 5px;
+			  text-indent:25px;
 			}
 		}