Browse Source

项目订单

zhaoxiaohai 2 years ago
parent
commit
c4d8ce8e24

+ 2 - 1
app.json

@@ -12,7 +12,8 @@
         "shopping/index",
         "orderForm/index",
         "orderForm/detail",
-        "orderForm/add/add"
+        "orderForm/add/add",
+        "orderForm/modules/setBrand/index"
       ]
     },
     {

+ 6 - 0
packageA/orderForm/detail.js

@@ -450,6 +450,12 @@ Page({
 			}
 		})
 	},
+	/* 设置项目订单品牌领域 */
+	setBraned() {
+		wx.navigateTo({
+			url: './modules/setBrand/index?id=' + this.data.sa_orderid,
+		})
+	},
 	onUnload() {
 		let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
 		let content = page.data.content;

+ 1 - 0
packageA/orderForm/detail.wxml

@@ -8,6 +8,7 @@
     <view class="tags">
         <text wx:if="{{detail.brandname}}" style="background-color: #0079FE;">{{detail.brandname}}</text>
         <text wx:if="{{detail.tradefield}}" style="background-color: #4BD863;">{{detail.tradefield}}</text>
+        <text wx:if="{{detail.status=='新建' && detail.type=='项目订单'}}" style="background-color: #4BD863;" bindtap="setBraned">设置品牌/领域</text>
     </view>
     <view class="exp">订单类型:{{detail.type}}</view>
     <view class="exp">订单状态:{{detail.status}}</view>

+ 3 - 1
packageA/orderForm/modules/product/index.js

@@ -175,9 +175,11 @@ Component({
 		},
 		/* 去添加产品 */
 		addProduct() {
+			let detail = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/detail').data.detail;
+			console.log(detail)
 			wx.navigateTo({
 				url: `/select/product/index?params=${JSON.stringify({
-					"id": 20221109153502,
+					"id": detail.type=='项目合同'?20230103155002:20221109153502,
 					"content": {
 						nocache:true,
 						"sa_orderid": this.data.sa_orderid, //订单ID

+ 81 - 0
packageA/orderForm/modules/setBrand/index.js

@@ -0,0 +1,81 @@
+const _Http = getApp().globalData.http;
+Page({
+  data: {
+    skeletonShow: false,
+    loading: false,
+    sa_brandid: null,
+    tradefield: null,
+    brandList: [],
+    domainList: []
+  },
+  onLoad(options) {
+    console.log(options)
+    _Http.basic({
+      "id": 20230105144102,
+      "content": {
+        nocache: true,
+        "sa_orderid": options.id
+      }
+    }).then(res => {
+      console.log(res)
+      this.setData({
+        brandList: res.data.brands,
+        domainList: res.data.tradefields,
+      })
+    })
+  },
+  /* 选择品牌 */
+  onSelectBrand(e) {
+    let {
+      item
+    } = e.currentTarget.dataset;
+    if (this.data.sa_brandid == item.sa_brandid) return;
+    this.setData({
+      sa_brandid: item.sa_brandid
+    })
+  },
+  /* 选择领域 */
+  onSelect(e) {
+    let {
+      item
+    } = e.currentTarget.dataset;
+    if (this.data.tradefield == item.tradefield) return;
+    this.setData({
+      tradefield: item.tradefield
+    })
+  },
+  submit() {
+    if (this.data.loading) return;
+    this.setData({
+      loading: true
+    })
+    _Http.basic({
+      "id": 20221108111402,
+      content: {
+        sa_orderid: 0,
+        sa_accountclassid: 0,
+        rec_contactsid: 0,
+        pay_enterpriseid: 0,
+        "sa_brandid": this.data.sa_brandid, //品牌ID
+        "type": "标准订单", //订单类型
+        "tradefield": this.data.tradefield, //必选
+      }
+    }).then(res => {
+      this.setData({
+        loading: false
+      })
+      console.log("创建标准订单", res);
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : '创建成功',
+        icon: "none"
+      });
+      if (res.msg == '成功') setTimeout(() => {
+        wx.redirectTo({
+          url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+        });
+        let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
+        if (page) page.getList(true);
+      }, 500)
+    })
+  }
+})

+ 3 - 0
packageA/orderForm/modules/setBrand/index.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 90 - 0
packageA/orderForm/modules/setBrand/index.scss

@@ -0,0 +1,90 @@
+page {
+	background-color: #fff;
+}
+
+.groud {
+	width: 100%;
+	padding: 30rpx;
+	border-bottom: 1px solid #DDDDDD;
+
+	.label {
+		height: 60rpx;
+		font-size: 32rpx;
+		font-family: PingFang SC-Regular, PingFang SC;
+		font-weight: bold;
+		color: #333333;
+	}
+
+	.content {
+		display: flex;
+		flex-wrap: wrap;
+		width: 100%;
+
+		.but {
+			min-width: 188rpx;
+			height: 72rpx;
+			background: #F5F5F5;
+			border-radius: 8rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #333333;
+			box-sizing: border-box;
+			margin-right: 20rpx;
+			margin-top: 20rpx;
+			padding: 0 30rpx;
+		}
+
+		.active {
+			border: 1px solid #3874F6;
+			color: #3874F6;
+			font-weight: bold;
+			background-color: #F5F5F5;
+		}
+	}
+
+	.time {
+		.partition {
+			margin-right: 20rpx;
+			display: flex;
+			align-items: center;
+		}
+
+		.tbox {
+			width: 220rpx;
+			height: 72rpx;
+			text-align: center;
+			line-height: 72rpx;
+			background: #F5F5F5;
+			border-radius: 8rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #333333;
+			box-sizing: border-box;
+			margin-right: 20rpx;
+			margin-top: 20rpx;
+		}
+	}
+}
+
+
+.footer {
+	display: flex;
+	justify-content: center;
+	position: fixed;
+	bottom: 0;
+	width: 100vw;
+	min-height: 130rpx;
+	background-color: #fff;
+	box-shadow: rgba(0, 0, 0, 0.15) 0px 5rpx 15rpx 0px;
+
+	.but {
+		width: 690rpx;
+		height: 90rpx;
+		background: #FA8C16;
+		border-radius: 16rpx;
+		font-size: 28rpx;
+		font-weight: 600;
+		color: #FFFFFF;
+		margin-top: 10rpx;
+	}
+}

+ 21 - 0
packageA/orderForm/modules/setBrand/index.wxml

@@ -0,0 +1,21 @@
+<view class="groud">
+	<view class="label">
+		选择品牌
+	</view>
+	<view class="content">
+		<van-button custom-class='but {{item.sa_brandid==sa_brandid?"active":""}}' wx:for="{{brandList}}" wx:key="item.sa_brandid" data-item="{{item}}" bindtap="onSelectBrand">{{item.brandname}}</van-button>
+	</view>
+</view>
+<view class="groud">
+	<view class="label">
+		选择领域
+	</view>
+	<view class="content">
+		<van-button custom-class='but {{item.tradefield==tradefield?"active":""}}' wx:for="{{domainList}}" wx:key="item.sys_enterprise_tradefieldid" data-item="{{item}}" bindtap="onSelect">{{item.tradefield}}</van-button>
+	</view>
+</view>
+<!-- 底部 -->
+<view style="height: 150rpx;" />
+<view class="footer">
+	<van-button custom-class='but' loading='{{loading}}' loading-text='创建中...' bindtap="submit">创建订单</van-button>
+</view>