lilei 11 ヶ月 前
コミット
f993759430
5 ファイル変更116 行追加98 行削除
  1. 1 1
      App.vue
  2. 26 0
      api/purchase.js
  3. 13 16
      pagesB/coupon.vue
  4. 20 61
      pagesB/procureOrder.vue
  5. 56 20
      pagesB/promoDetail.vue

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			baseUrl: 'http://192.168.2.103:9110/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/' // 生产
 		},

+ 26 - 0
api/purchase.js

@@ -0,0 +1,26 @@
+import request from './request';
+
+// 促销活动采购单保存
+export const purchaseSave = params => {
+  return request({
+    url: `purchase/create`,
+    method: 'post',
+    data: params
+  })
+}
+// 采购单-分页
+export const purchaseQueryPage = params => {
+  return request({
+    url: `purchase/queryPage/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
+    data: params
+  })
+}
+// 采购单产品明细-分页
+export const purchaseQueryDetailPage = params => {
+  return request({
+    url: `purchase/queryDetailPage/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
+    data: params
+  })
+}

+ 13 - 16
pagesB/coupon.vue

@@ -10,32 +10,32 @@
 						<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
 							<view  
 							class="check-order-list" 
-							v-for="(item,index) in 10" 
-							:key="item" 
+							v-for="(item,index) in list" 
+							:key="item.id" 
 							>
 								<view>
 									<view class="dio dio-left"></view>
 									<view class="dio dio-right"></view>
 									<view class="check-order-left" :class="'imgbg-'+current">
-										¥<text>100</text>
+										¥<text>{{item.ticketValue}}</text>
 									</view>
 									<view class="check-order-right">
-										<view class="check-order-title">满1000减100</view>
-										<view class="check-order-subtitle">箭冠轮胎,五一大福利。</view>
+										<view class="check-order-title">{{item.activeName}}</view>
+										<view class="check-order-subtitle">{{item.activeTitle}}</view>
 										<view class="check-order-date">
-											<view v-if="current!=1">2024.07.22 13:00:00 至</view>
-											<view v-if="current!=1">2024.08.22 13:00:00 到期 </view>
-											<view class="use-date" v-if="current==1">使用时间:2021-12-31</view>
+											<view>{{item.validStartDate}} 至</view>
+											<view>{{item.validEndDate}} 到期 </view>
+											<!-- <view class="use-date" v-if="current==1">使用时间:2021-12-31</view> -->
 										</view>
 									</view>
 								</view>
-								<view>
+								<view v-if="item.ticketExplain">
 									<view class="check-order-desc" :class="'border-'+current" @click="item.showDesc = !item.showDesc">
 										<text>使用说明:</text>
 										<u-icon name="arrow-down"></u-icon>
 									</view>
 									<view class="check-order-desc-content">
-										 仅限箭冠产品,轮胎类,满1000,才能使用。
+										 {{item.ticketExplain}}
 									</view>
 								</view>
 							 </view>
@@ -120,7 +120,6 @@
 				this.swiperCurrent = index;
 			},
 			swiperChange(event){
-				console.log(event.detail)
 				this.list = []
 				this.status = "loading"
 			},
@@ -178,11 +177,9 @@
 			  this.status = "loading"
 			  ticketQueryList(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
-				  if(_this.pageNo>1){
-					  _this.list = _this.list.concat(res.data.list || [])
-				  }else{
-					  _this.list = res.data.list || []
-				  }
+				  const list = res.data.list || []
+				  list.map(k => k.showDesc = false)
+				  _this.list = _this.list.concat(list)
 				  _this.total = res.data.count || 0
 				} else {
 				  _this.list = []

+ 20 - 61
pagesB/procureOrder.vue

@@ -22,21 +22,21 @@
 						{{partList.length}}款,共<text class="redText">{{totalNums}}</text>件
 					</view>
 				</view>
-				<view v-for="item in partList" :key="item.productSn" class="flex align-center item-list">
+				<view v-for="item in partList" :key="item.id" class="flex align-center item-list">
 					<view style="height: 150rpx;">
-						<u-image :src="item.images" border-radius="16" width="200" height="150" bg-color="#EBEBEB" ></u-image>
-						<view class="back-price">返<text>¥15</text></view>
+						<u-image :src="item.product.images" border-radius="16" width="200" height="150" bg-color="#EBEBEB" ></u-image>
+						<view class="back-price">返<text>¥{{item.giveAmount}}</text></view>
 					</view>
 					<view>
 						<view class="item-name">
-						  <text>{{item.productName}}</text>
+						  <text>{{item.product.productName}}</text>
 						</view>
 						<view class="item-nums">
-							<text>{{item.productCode}}</text>
+							<text>{{item.product.origCode}}</text>
 						</view>
 						<view class="item-head">
 							<view>
-								数量:<text class="redText">{{item.qty}}</text>{{item.unit}}
+								数量:<text class="redText">{{item.qty}}</text>{{item.product&&item.product.unit||''}}
 							</view>
 						</view>
 					</view>
@@ -49,15 +49,15 @@
 				</view>
 				<view class="infoList dju">
 					<text>订单号</text>
-					<text>{{info.shelfOrderNo||'--'}}</text>
+					<text>{{info.purchaseNo||'--'}}</text>
 				</view>
 				<view class="infoList">
 					<text>下单时间</text>
-					<text>{{info.shelfOrderDate||'--'}}</text>
+					<text>{{info.purchaseDate||'--'}}</text>
 				</view>
 				<view class="infoList">
 					<text>下单人员</text>
-					<text>{{info.orderPersonName || '--'}}</text>
+					<text>{{info.purchaserName || '--'}}</text>
 				</view>
 			</view>
 		</view>
@@ -65,16 +65,8 @@
 </template>
 
 <script>
-	import carNo from '@/components/carNo.vue'
-	import uniIcons from "@/components/uni-icons/uni-icons.vue"
-	import moment from 'moment'
-	import { findBySnShelfOrder, cancelShelfOrder, takeGoods } from '@/api/shelf.js'
 	export default {
-	   name: 'orderDetail-digitalShel',
-	   components: {
-		uniIcons,
-		carNo
-	   },
+	   name: 'procureDetailOrder',
 	   data() {
 		   return {
 			   loading: false,
@@ -83,44 +75,30 @@
 			   statusIcon: '', // 结算状态icon
 			   statusMessage: '',
 			   partList: [], // 配件列表
-			   shelfOrderSn: null,
-			   state: ''
+			   state: 'success'
 		   }
 	   },
-	   onReady() {
-	   },
 	   onLoad(option) { 
-		  this.shelfOrderSn = option.shelfOrderSn
-		  this.state = option.state
+		  const data = this.$store.state.vuex_tempData
+		  if(data){
+			  this.info = data
+			  this.partList = data.detailList
+		  }
 		  uni.setNavigationBarTitle({
 		  	title: ''
 		  })
 		  // 更改标题栏背景色
 		  uni.setNavigationBarColor({
 		  	frontColor: '#ffffff',
-		  	backgroundColor: option.state!= 'error' ? '#066cff':'#ff5500',
+		  	backgroundColor: this.state!= 'error' ? '#066cff':'#ff5500',
 		  })
 	   },
 	   onShow() {
-	   	 // this.getDetail()
-		 this.info = {
-			 orderPersonName: '张三',
-			 shelfOrderDate: moment().format('YYYY-MM-DD HH:mm:ss'),
-			 shelfOrderNo: '12345678901234567890',
-			 billState: 'success'
-		 }
 		 this.statusText = '提交成功'
 		 this.statusIcon = 'checkmark-circle'
-		 this.partList = [
-			 {
-			 	id: new Date().getTime(),
-			 	productName: '长安回望绣成堆,山顶千门次第开,一骑红尘妃子笑,无人知是荔枝来',
-			 	images: 'https://cdn.uviewui.com/uview/common/logo.png',
-				productCode:'432-ddsaf-jjj',
-				qty: 5,
-			 	unit: '个'
-			 }
-		 ]
+	   },
+	   onUnload() {
+	   	this.$store.state.vuex_tempData = null
 	   },
 	   computed: {
 		   totalNums(){
@@ -138,25 +116,6 @@
 		 		title: title
 		 	})
 		 },
-		  // 获取详情
-		  getDetail(){
-			  findBySnShelfOrder({sn: this.shelfOrderSn}).then(res => {
-				  if(res.status == 200){
-					  this.info = res.data
-					  this.partList = res.data.shelfOrderDetailList || []
-					  if(this.info.billState == 'success'){
-						  this.statusText = '提交成功'
-						  this.statusIcon = 'checkmark-circle'
-						  this.statusMessage = ''
-					  }
-					  if(this.info.billState == 'error'){
-						  this.statusText = '提交失败'
-						  this.statusIcon = 'close-circle'
-						  this.statusMessage = ''
-					  }
-				  }
-			  })
-		  },
 	   }
 	}
 </script>

+ 56 - 20
pagesB/promoDetail.vue

@@ -13,14 +13,14 @@
 					>
 						<view class="video-item">
 							<view>
-								<u-image :src="item.imageSet[0]" height="140px" width="100%"></u-image>
-								<view class="back-price">返<text>¥15</text></view>
+								<u-image :src="item.productImage" height="140px" width="100%"></u-image>
+								<view class="back-price">返<text>¥{{item.promoRuleValue}}</text></view>
 							</view>
 							<view>
-								<view class="product-name">{{item.name}}</view>
-								<view class="product-guige">{{item.origCode}}</view>
+								<view class="product-name">{{item.productName}}</view>
+								<view class="product-guige">{{item.productOrigCode}}</view>
 								<view class="product-button">
-									<view class="price-txt">¥<text>{{item.price}}</text></view>
+									<view class="price-txt">¥<text>{{item.cost}}</text></view>
 									<view>
 										<u-button v-if="!item.checked" :throttle-time="50" @click="chooseProduct(item)" size="mini" type="primary" shape="circle"><u-icon name="plus"></u-icon></u-button>
 										<u-button v-else :throttle-time="50" @click="chooseProduct(item)" size="mini" type="success" shape="circle"><u-icon name="plus"></u-icon>{{item.qty}}</u-button>
@@ -82,14 +82,14 @@
 							<view class="choose-product-item">
 								 <view>
 									 <view class="choose-product-item-img">
-										<u-image :src="item.images" height="200rpx" width="100%"></u-image>
-										<view class="back-price">返<text>¥15</text></view>
+										<u-image :src="item.productImage" height="200rpx" width="100%"></u-image>
+										<view class="back-price">返<text>¥{{item.promoRuleValue}}</text></view>
 									 </view>
 									 <view class="choose-product-item-info">
-										<view class="choose-product-item-left-info-name">{{item.name}}</view>
-										<view class="choose-product-item-left-info-guige">{{item.origCode}}</view>
+										<view class="choose-product-item-left-info-name">{{item.productName}}</view>
+										<view class="choose-product-item-left-info-guige">{{item.productOrigCode}}</view>
 										<view class="choose-product-item-left-info-price">
-											<view class="price-txt">¥<text>{{item.price}}</text></view>
+											<view class="price-txt">¥<text>{{item.cost}}</text></view>
 											<view>
 												<u-number-box v-model="item.qty" :index="item.id" :input-width="60" :input-height="60" size="mini" :min="0" @change="changeQty"></u-number-box>
 											</view>
@@ -112,6 +112,7 @@
 	    mapMutations,
 	} from 'vuex'
 	import { queryPromoProductByPage } from '@/api/video.js'
+	import { purchaseSave } from '@/api/purchase.js'
 	export default {
 		data() {
 			return {
@@ -157,6 +158,7 @@
 			uni.setNavigationBarTitle({
 				title: opts.title||'促销活动产品'
 			})
+			this.$store.state.vuex_tempData = null
 			this.promoActiveSn = opts.promoActiveSn
 			this.pageInit()
 		},
@@ -267,7 +269,7 @@
 				})
 				this.chooseProductList.splice()
 			},
-			// 清空已选列表
+			// 确定清空已选列表
 			claerChoose(){
 				const _this = this
 				uni.showModal({
@@ -276,15 +278,19 @@
 					confirmText: '确定',
 					success(res) {
 						if(res.confirm){
-							_this.chooseList = []
-							_this.chooseProductList = []
-							_this.showChoosePopu = false
-							// 重置已选状态
-							_this.list.filter(item => item.checked).map(item=>item.checked = false)
+							_this.clearChooseData()
 						}
 					}
 				})
 			},
+			// 清空已选数据
+			clearChooseData(){
+				this.chooseList = []
+				this.chooseProductList = []
+				this.showChoosePopu = false
+				// 重置已选状态
+				this.list.filter(item => item.checked).map(item=>item.checked = false)
+			},
 			// scroll-view到底部加载更多
 			onreachBottom() {
 				if(this.list.length < this.total){
@@ -309,7 +315,11 @@
 			  this.status = "loading"
 			  queryPromoProductByPage(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
-				  _this.list = _this.list.concat(res.data.list||[])
+				  const list = res.data.list||[]
+				  list.map(k => {
+					  k.checked = false
+				  })
+				  _this.list = _this.list.concat(list)
 				  _this.total = res.data.count || 0
 				} else {
 				  _this.list = []
@@ -322,9 +332,34 @@
 			// 提交订单
 			submitOrder(){
 				if(this.showChoosePopu){
-					console.log(this.chooseList)
-					uni.navigateTo({
-						url: '/pagesB/procureOrder?id='
+					uni.showLoading({
+						title: '提交中...',
+						mask: true
+					})
+					const detailList = []
+					this.chooseList.map(item => {
+						detailList.push({
+								promoActiveSn: this.promoActiveSn,
+								promoRuleSn:item.promoRuleSn,
+								productSn:item.productSn,
+								productCode:item.productCode,
+								qty:item.qty,
+								price:item.cost,
+								giveAmount:item.promoRuleValue
+						})
+					})
+					purchaseSave({
+						promoActiveSn: this.promoActiveSn,
+						detailList: detailList
+					}).then(res => {
+						if(res.status == 200){
+							this.clearChooseData()
+							this.$store.state.vuex_tempData = res.data
+							uni.navigateTo({
+								url: '/pagesB/procureOrder?id='+res.id
+							})
+						}
+						uni.hideLoading()
 					})
 				}else{
 					this.openChoose()
@@ -406,6 +441,7 @@
 					background: #ffffff;
 					border-radius: 10upx;
 					box-shadow: 1px 1px 3px #EEEEEE;
+					height: 100%;
 					> view{
 						&:first-child{
 							position: relative;