lilei 9 月之前
父節點
當前提交
fb0938c4aa
共有 7 個文件被更改,包括 106 次插入42 次删除
  1. 1 1
      App.vue
  2. 1 1
      api/shop.js
  3. 2 2
      pages/index/index.vue
  4. 1 1
      pages/index/productItem.vue
  5. 51 14
      pagesB/cart/index.vue
  6. 7 4
      pagesB/cart/productitem.vue
  7. 43 19
      pagesB/shopiing/productDetail.vue

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			baseUrl: 'http://192.168.2.131:9688/saas/clz/', // 本地
+			baseUrl: 'http://192.168.2.10:7002/saas/clz/', // 本地
 			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 1 - 1
api/shop.js

@@ -14,7 +14,7 @@ export function getShopDetail(params) {
 	return request({
 	  url: `shopProduct/queryBySn/${params.shopProductSn}`,
 	  method: 'post',
-	  data: params
+	  data: {}
 	},true)
 }
 

+ 2 - 2
pages/index/index.vue

@@ -83,7 +83,7 @@
 						<iconItemsList :list="navList" :iconSize="45" @callback="onNavFun"></iconItemsList>
 					</view>
 					<!-- 产品分类 -->
-					<view class="ptype-nav pa-box" v-if="hasShopiing">
+					<view class="ptype-nav pa-box" v-if="hasShopiing&&productTypeList.length">
 						<swiper class="swiper" @change="e=>{currentPtypeDot=e.detail.current}">
 							<swiper-item v-for="(item, idx) in productTypeList" :index="idx" :key="item.id">
 								<iconItemsList :list="item.list" type="img"></iconItemsList>
@@ -94,7 +94,7 @@
 						</view>
 					</view>
 					<!-- 产品列表 -->
-					<view class="product-box" v-if="hasShopiing">
+					<view class="product-box" v-if="hasShopiing && productList.length">
 						<u-divider bg-color="">热门推荐</u-divider>
 						<view class="product-list">
 							<!-- 产品列表 -->

+ 1 - 1
pages/index/productItem.vue

@@ -14,7 +14,7 @@
 			</view>
 			<view>
 				<view class="product-name ellipsis-two">{{item.productName}}</view>
-				<view class="product-guige"><text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
+				<view class="product-guige" v-if="item.productOrigCode"><text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
 				<view class="product-button">
 					<view class="price-txt flex align_center">¥<text>{{isLogin ? item.price : '***'}}</text></view>
 					<view>

+ 51 - 14
pagesB/cart/index.vue

@@ -52,7 +52,8 @@
 						<view class="cart-footer-left">
 								<view class="cart-footer-left-all" @click="chooseAll">
 									<view class="cart-footer-left-all-icon">
-										<image style="width: 24px;height: 24px;" mode="aspectFill" :src="'../static/'+(allChecked?'round_check_fill':'round')+'.png'"></image>
+										<uni-icons :type="allChecked?'checkbox-filled':'circle'" size="24" :color="allChecked?'#dd0000':'#666'"></uni-icons>
+										<!-- <image style="width: 24px;height: 24px;" mode="aspectFill" :src="'../static/'+(allChecked?'round_check_fill':'round')+'.png'"></image> -->
 									</view>
 									<view class="cart-footer-left-all-text">
 										<text>全选</text>
@@ -72,7 +73,7 @@
 								<text>清空购物车</text>
 							</view> -->
 							<view class="cart-footer-right-button">
-								<button class="btns" v-if="!editFlag" type="warn" size="mini" @click="settlement">去结算({{totalNum}})</button>
+								<button class="btns" :loading="loading" v-if="!editFlag" type="warn" size="mini" @click="settlement">去结算({{totalNum}})</button>
 								<button v-else class="btns" type="warn" plain size="mini" @click="batchRemove">删除</button>
 							</view>
 						</view>
@@ -106,6 +107,7 @@
 		},
 		data() {
 			return {
+				loading: false,
 				status: 'loading',
 				noDataText: '暂无活动',
 				empty: {
@@ -171,7 +173,7 @@
 							productCode: key.productEntity.code,
 							productOrigCode: key.productEntity.origCode,
 							unit: key.productEntity.unit,
-							enabledFlag: key.enabledFlag
+							status: key.status
 						})
 				  })
 				  _this.list.push(ret)
@@ -359,27 +361,62 @@
 			},
 			// 去结算
 			submitOrder(){
-				uni.showLoading({
-					title: '提交中...',
-					mask: true
-				})
+				const _this = this
 				// 获取已选商品
 				const detailList = []
 				const cartSn = []
+				const soldOutSn = []
+				const sellOutSn = []
 				this.list.forEach(key => {
 					key.filter(item=>item.checked).forEach(item => {
-						detailList.push({
-							productSn:item.productSn,
-							productCode:item.productCode,
-							qty: item.qty,
-							price:item.price,
-						})
-						cartSn.push(item.cartSn)
+						// 已下架产品提示
+						if(item.status == 0){
+							soldOutSn.push(item.productCode)
+						}
+						//售罄产品提示
+						else if(item.sellout == 0){
+							sellOutSn.push(item.productCode)
+						}else{
+							detailList.push({
+								productSn:item.productSn,
+								productCode:item.productCode,
+								qty: item.qty,
+								price:item.price,
+							})
+							cartSn.push(item.cartSn)
+						}
+					})
+				})
+				
+				// 提示信息
+				if(soldOutSn.length || sellOutSn.length){
+					uni.showModal({
+						title: '提示',
+						content: (soldOutSn.length ? `产品${soldOutSn.join(',')}已下架,`:'')+(sellOutSn.length?`产品${sellOutSn.join(',')}已售罄,`:'')+`不可采购。是否继续采购其他产品?`,
+						success(res) {
+							if(res.confirm){
+								_this.submitForm(detailList,cartSn)
+							}
+						}
 					})
+					return
+				}
+				
+				// 提交
+				this.submitForm(detailList,cartSn)
+			},
+			// 确认提交
+			submitForm(){
+				uni.showLoading({
+					title: '提交中...',
+					mask: true
 				})
+				this.loading = true
 				purchaseSave({
 					detailList: detailList
 				}).then(res => {
+					this.loading = false
+					uni.hideLoading()
 					if(res.status == 200){
 						// 删除已提交产品
 						this.removeCart(cartSn,true)

+ 7 - 4
pagesB/cart/productitem.vue

@@ -5,12 +5,13 @@
 		:key="item.cartSn" 
 		>
 			<view class="choose-product-item-check" @click="checkItem(item.cartSn)">
-				<image style="width: 24px;height: 24px;" mode="aspectFill" :src="'../static/'+(item.checked?'round_check_fill':'round')+'.png'"></image>
+				<!-- <image style="width: 24px;height: 24px;" mode="aspectFill" :src="'../static/'+(item.checked?'round_check_fill':'round')+'.png'"></image> -->
+				<uni-icons :type="item.checked?'checkbox-filled':'circle'" size="24" :color="item.checked?'#dd0000':'#666'"></uni-icons>
 			</view>
 			 <view>
 				 <view class="choose-product-item-img">
 					<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="width: 100%;height: 180rpx;"></image>
-					<!-- <view class="back-price" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view> -->
+					<view class="back-price xiajia" v-if="item.status==0">下架</view>
 					<view class="choose-product-item-left-info-code">
 						<text max-lines="1" overflow="ellipsis">{{item.productCode}}</text>
 					</view>
@@ -145,11 +146,9 @@
 			.back-price{
 				zoom: calc(0.8);
 				padding: 6rpx 65rpx;
-				background: rgba(255 ,87 ,34 , 1);
 				position: absolute;
 				top: 18rpx;
 				right: -45rpx;
-				color: #fff;
 				z-index: 2;
 				font-size: 20rpx;
 				text-align: center;
@@ -161,6 +160,10 @@
 					margin: 0 5rpx;
 				}
 			}
+			.xiajia{
+				background: rgba(222, 222, 222, 1.0);
+				color: #5f5f5f;
+			}
 			.choose-product-item-left-info-code{
 				color: #666;
 				position: absolute;

+ 43 - 19
pagesB/shopiing/productDetail.vue

@@ -17,9 +17,9 @@
 				<view :style="{height:statusBarHeight+'px'}"></view>
 				<u-swiper mode="number" :border-radius="0" bg-color="#000" img-mode="widthFix" :interval="3000" :height="450" :list="imgList"></u-swiper>
 				<view class="product-info-text">
-					<view class="product-info-text-title">{{detail.productName}}</view>
+					<view class="product-info-text-title">{{detail.productName}} <view class="copyText" @click="copy(detail.product.origCode)">复制</view></view>
 					<view class="product-info-text-attr">
-						<view class="product-info-price">
+						<view class="product-info-price flex align_center">
 							¥<text class="price-red">{{hasLogin ? detail.price : '***'}}</text>
 						</view>
 						<view class="product-info-nums">
@@ -31,19 +31,18 @@
 				</view>
 			</view>
 			<u-divider bg-color="">商品详情</u-divider>
-			<view class="product-info-guige" v-if="detail">
-				<view class="row">品牌:<text>{{detail.productBrandName||'--'}}</text></view>
-				<view class="row-ban">原厂编码:<text>{{detail.productOrigCode||'--'}} </text></view>
-				<view class="row-ban">产品编码:<text>{{detail.productCode||'--'}}</text></view>
-				<view class="row-ban">计量单位:<text>{{detail.unit||'--'}}</text></view>
-				<view class="row-ban">包装数:<text>{{ (detail && detail.packQty) || '--' }}{{ (detail && detail.packQty) ? detail.unit : '' }}/{{ detail.packQtyUnit||'--' }}</text></view>
-				<view class="row-ban">尺寸:<text>{{detail.size||'--'}}</text></view>
-				<view class="row-ban">内盒尺寸:<text>{{detail.size||'--'}}</text></view>
-				<view class="row-ban">重量:<text>{{detail.weight||'--'}}</text></view>
-				<view class="row-ban">颜色:<text>{{detail.color||'--'}}</text></view>
+			<view class="product-info-guige" v-if="detail&&detail.product">
+				<view class="row">品牌:<text>{{detail.product.productBrandName||'--'}}</text></view>
+				<view class="row">原厂编码:<text>{{detail.product.origCode||'--'}} </text> <view class="copyText" @click="copy(detail.product.origCode)">复制</view></view>
+				<view class="row">产品编码:<text>{{detail.product.code||'--'}}</text> <view class="copyText" @click="copy(detail.product.origCode)">复制</view></view>
+				<view class="row">条形码:<text>{{detail.product.qrCode||'--'}}</text> <view class="copyText" @click="copy(detail.product.origCode)">复制</view></view>
+				<view class="row-ban">商品尺寸:<text>{{detail.product.size||'--'}}</text></view>
+				<view class="row-ban">计量单位:<text>{{detail.product.unit||'--'}}</text></view>
+				<view class="row-ban">重量:<text>{{detail.product.weight||'--'}}</text></view>
+				<view class="row-ban">包装数:<text>{{ (detail.product.packQty) || '--' }}{{ detail.product.packQty ? detail.product.unit : '' }}/{{ detail.product.packQtyUnit||'--' }}</text></view>
 			</view>
 			<view class="product-info-content">
-				<rich-text v-if="detail && detail.description" :nodes="detail.description"></rich-text>
+				<rich-text v-if="detail && detail.product && detail.product.description" :nodes="detail.product.description"></rich-text>
 				<view v-else style="font-size: 12px;color: #999;text-align: center;">暂无产品介绍</view>
 			</view>
 		</view>
@@ -52,7 +51,7 @@
 			<view class="scrollPage-footer-box">
 				<view class="footer-left">
 					<view class="footer-left-item" @click="toCart">
-						<u-icon :size='50' name="shopping-cart"></u-icon>
+						<u-icon :size='50' color="#666" name="shopping-cart"></u-icon>
 						<text class="footer-left-item-text">购物车</text>
 						<text class="badge" v-if="totalNum">{{totalNum>99?'99+':totalNum}}</text>
 					</view>
@@ -156,6 +155,12 @@
 			goBack(){
 				uni.navigateBack()
 			},
+			// 复制
+			copy(text){
+				uni.setClipboardData({
+					data: text,
+				})
+			},
 			// 产品详情
 			getDetail(){
 				uni.showLoading({
@@ -167,7 +172,13 @@
 				}).then(res => {
 					if(res.status == 200){
 						this.detail = res.data
-						this.imgList = [res.data.productMsg]
+						if(res.data && res.data.productPicList){
+							res.data.productPicList.forEach(item => {
+								this.imgList.push(item.imageUrl+'?x-oss-process=image/resize,p_50')
+							})
+						}else{
+							this.imgList.push(res.data.productMsg+'?x-oss-process=image/resize,p_50')
+						}
 					}
 					uni.hideLoading()
 				})
@@ -183,6 +194,11 @@
 			// 加入购物车
 			addCart(){
 				if(this.hasLogin){
+					uni.showLoading({
+						title: '加入中...',
+						mask: true
+					})
+					// 加入购物车
 					addCart({
 						qty: 1,
 						price: this.detail.price,
@@ -190,10 +206,7 @@
 					}).then(res => {
 						if(res.status == 200){
 							this.cartCount()
-							uni.showToast({
-								title: '加入成功',
-								icon: 'success'
-							})
+							uni.hideLoading()
 						}
 					})
 				}else{
@@ -308,6 +321,17 @@
 				}
 			}
 		}
+		.copyText{
+			background-color: #efefef;
+			border-radius: 100rpx;
+			padding: 0 20rpx;
+			color: #03A9F4;
+			font-size: 20rpx;
+			display: inline-block;
+			margin-left: 20rpx;
+			height: 44rpx;
+			line-height: 44rpx;
+		}
 		.scrollPage-content{
 				flex: 1;
 				overflow-y: auto;