Pārlūkot izejas kodu

科室推荐产品

xiaohaizhao 1 nedēļu atpakaļ
vecāks
revīzija
e8483e1acf

+ 7 - 5
pages/login/modules/login.js

@@ -58,12 +58,14 @@ function init() {
         wx.setStorageSync('siteP', list[1].data);
         wx.setStorageSync('banner_list', list[2].data)
         if (!getApp().globalData.socketEstablish) getApp().initSocket();
-        console.log("list[3].data", list[3].data)
-        console.log(wx.getStorageSync('userMsg').usertype)
-        let data = list[3].data.find(v => v.templetname == '站点全部');
-        if (data) {
+        if (wx.getStorageSync('userMsg').usertype == '0') {
+            let data = list[3].data.find(v => v.templetname == '站点全部');
+            if (data) {
+                list[3].data = list[3].data.filter(v => v.templetname != '站点全部')
+                list[3].data.unshift(data)
+            }
+        } else {
             list[3].data = list[3].data.filter(v => v.templetname != '站点全部')
-            list[3].data.unshift(data)
         }
         wx.setStorageSync('templetList', list[3].data)
 

+ 9 - 2
project.private.config.json

@@ -10,12 +10,19 @@
     "condition": {
         "miniprogram": {
             "list": [
+                {
+                    "name": "科室详情",
+                    "pathName": "prsx/department/detail",
+                    "query": "id=11",
+                    "scene": null,
+                    "launchMode": "default"
+                },
                 {
                     "name": "医院详情",
                     "pathName": "prsx/hospital/detail",
                     "query": "id=6736",
-                    "scene": null,
-                    "launchMode": "default"
+                    "launchMode": "default",
+                    "scene": null
                 },
                 {
                     "name": "prsx/department/detail",

+ 132 - 7
prsx/department/Product/index.js

@@ -25,14 +25,62 @@ Component({
         list: [],
         showSearch: false,
         focus: false,
-        condition: ""
-    },
-    lifetimes: {
-        attached: function () {
-            getApp().globalData.Language.getLanguagePackage(this)
-        }
+        condition: "",
+        stages: [],
+        showAction: false
     },
     methods: {
+        changeStage(e) {
+            const {
+                item
+            } = e.currentTarget.dataset,
+                that = this;
+            this.setData({
+                stages: this.data.stages.map(v => {
+                    v.color = v.stagename == item.stagename ? '#3874F6' : ''
+                    return v
+                }),
+                showAction: true,
+                changeItem: item
+            })
+        },
+        onSelect({
+            detail
+        }) {
+            let item = this.data.changeItem,
+                that = this;
+            if (detail.color) return that.onCancel()
+
+            wx.showModal({
+                content: `是否确定将阶段修改为“${detail.stagename}”?`,
+                complete: ({
+                    confirm
+                }) => {
+                    if (confirm) _Http.basic({
+                        "id": "2025102110224102",
+                        "content": {
+                            sa_hospitaldep_itemid: item.sa_hospitaldep_itemid,
+                            sa_devstageid: detail.sa_devstageid
+                        },
+                    }).then(res => {
+                        wx.showToast({
+                            title: res.code == 1 ? '修改成功' : res.msg,
+                            icon: "none"
+                        })
+                        if (res.code == 1) {
+                            that.getList('', true)
+                            that.onCancel()
+                        }
+                    })
+                }
+            })
+        },
+        onCancel() {
+            this.setData({
+                showAction: false,
+                changeItem: null
+            })
+        },
         getList(id, init = false) {
             let content = {
                 ...this.data.content,
@@ -42,6 +90,25 @@ Component({
                 content.pageNumber = 1
                 content.pageTotal = 1
             }
+            if (this.data.stages.length == 0) _Http.basic({
+                "content": {
+                    "pageNumber": 1,
+                    "pageSize": 999,
+                    "where": {
+                        "condition": ""
+                    }
+                },
+                "id": 2025100916245502,
+            }).then(res => {
+                console.log("获取阶段列表", res)
+                if (res.code != 1) return;
+                this.setData({
+                    stages: res.data.map(v => {
+                        v.name = v.stagename
+                        return v
+                    })
+                })
+            })
             _Http.basic({
                 "id": 2025102110205102,
                 content
@@ -51,7 +118,10 @@ Component({
                     title: res.data,
                     icon: "none"
                 });
-                let list = res.data
+                let list = res.data.map(v => {
+                    v.cover = v.attinfos.length ? _Http.getSpecifiedImage(v.attinfos[0]) : ''
+                    return v
+                })
                 this.setData({
                     "content.pageNumber": res.pageNumber + 1,
                     "content.pageTotal": res.pageTotal,
@@ -74,6 +144,61 @@ Component({
             wx.navigateTo({
                 url: `/prsx/select/product/index?params=${JSON.stringify(params)}&radio=true`
             })
+            let that = this;
+            _Http.handleSelect = ({
+                item
+            }) => {
+                wx.showModal({
+                    content: `是否确定添加“${item.itemname}”到推荐产品?`,
+                    complete: ({
+                        confirm
+                    }) => {
+                        if (confirm) _Http.basic({
+                            "id": "2025102110170902",
+                            "content": {
+                                "sa_hospitaldepid": that.data.sa_hospitaldepid,
+                                "itemids": [item.itemid]
+                            },
+                        }).then(res => {
+                            wx.showToast({
+                                title: res.code == 1 ? '添加成功' : res.msg,
+                                icon: "none"
+                            })
+                            if (res.code == 1) {
+                                that.getList('', true)
+                                getCurrentPages().find(v => v.__route__ == 'prsx/select/product/index').uploadList()
+                            }
+                        })
+                    }
+                })
+            }
+        },
+        deleteItem(e) {
+            const {
+                item
+            } = e.currentTarget.dataset,
+                that = this;
+            wx.showModal({
+                content: `是否确定删除“${item.itemname}”?`,
+                complete: ({
+                    confirm
+                }) => {
+                    if (confirm) _Http.basic({
+                        "id": "2025102110202602",
+                        "content": {
+                            sa_hospitaldep_itemid: item.sa_hospitaldep_itemid
+                        },
+                    }).then(res => {
+                        wx.showToast({
+                            title: res.code == 1 ? '删除成功' : res.msg,
+                            icon: "none"
+                        })
+                        if (res.code == 1) {
+                            that.getList('', true)
+                        }
+                    })
+                }
+            })
         },
         toSearch() {
             if (this.data.showSearch && this.data.content.where.condition) {

+ 113 - 179
prsx/department/Product/index.scss

@@ -39,217 +39,151 @@
 	padding-right: 10rpx !important;
 }
 
-.project-item {
-	display: flex;
-	align-items: center;
+.product-item {
 	background-color: #fff;
-	width: 690rpx;
-	border-radius: 8rpx;
-	margin: 0 auto 20rpx;
-	padding: 20rpx 30rpx;
 	box-sizing: border-box;
+	border-bottom: 1rpx solid #DDDDDD;
+	margin-bottom: 20rpx;
 
-	.main {
-		position: relative;
-		overflow: hidden;
-
-		.label {
-			font-size: 30rpx;
-			font-family: PingFang SC-Regular, PingFang SC;
-			color: #333333;
-		}
+	.product {
+		box-sizing: border-box;
 
-		.tag-box {
+		.mian {
+			position: relative;
 			display: flex;
-			align-items: center;
 			width: 100%;
+			box-sizing: border-box;
+			padding: 20rpx;
 
-			.datatag,
-			.systemtag {
+			.img {
+				position: relative;
 				flex-shrink: 0;
-				margin-top: 6rpx;
-				background: #3874f6;
-				color: #ffffff;
-				margin-right: 10rpx;
-				display: flex;
-				align-items: center;
-				height: 40rpx;
-				font-size: 20rpx;
-				padding: 0 10rpx;
-				border-radius: 20rpx;
-				font-family: PingFang SC-Regular, PingFang SC;
-			}
-
-			.datatag {
-				background: #FA8C16;
-			}
-		}
-
-		.replenish {
-			display: flex;
-			min-height: 34rpx;
-			font-size: 24rpx;
-			font-family: PingFang SC-Regular, PingFang SC;
-			color: #333333;
-			margin-top: 8rpx;
-			word-break: break-all;
-			white-space: pre-wrap;
-		}
-	}
-}
-
-.project-item {
-	display: flex;
-	align-items: center;
-	background-color: #fff;
-	width: 690rpx;
-	border-radius: 8rpx;
-	margin: 0 auto 20rpx;
-
-	.chart {
-		margin: 0 30rpx;
-		width: 100rpx;
-		flex-shrink: 0;
-
-		.circle {
-			width: 100rpx;
-			height: 100rpx;
-			position: relative;
-			border-radius: 50%;
-			box-shadow: inset 0 0 0 8rpx var(--assist);
-
-			.ab {
-				position: absolute;
-				left: 0;
-				right: 0;
-				top: 0;
-				bottom: 0;
-				margin: auto;
-			}
+				width: 112rpx;
+				height: 112rpx;
+				border-radius: 16rpx;
+				margin-right: 20rpx;
 
-			&_left {
-				border: 8rpx solid #ccc;
-				border-radius: 50%;
-				clip: rect(0, 50rpx, 100rpx, 0);
-			}
+				.err {
+					display: flex;
+					width: 100%;
+					height: 100%;
+					align-items: center;
+					justify-content: center;
+					font-size: 22rpx;
+					border: 1px solid #ddd;
+					box-sizing: border-box;
+					color: #666;
+					border-radius: 16rpx;
+				}
 
-			&_right {
-				border: 8rpx solid #ccc;
-				border-radius: 50%;
-				clip: rect(0, 100rpx, 100rpx, 50rpx);
+				.tag-box {
+					display: flex;
+					justify-content: center;
+					width: 100%;
+					position: absolute;
+					top: 94rpx;
+
+					.tag {
+						max-width: 70rpx;
+						font-family: PingFang SC, PingFang SC;
+						font-size: 18rpx;
+						color: #FFFFFF;
+						line-height: 32rpx;
+						border-radius: 16rpx;
+						background-color: #52C41A;
+						padding: 0 12rpx;
+					}
+				}
 			}
 
-			&_text {
+			.dec {
+				flex: 1;
+				width: 0;
+				min-height: 128rpx;
 				height: 100%;
-				display: flex;
-				flex-direction: column;
-				justify-content: center;
-				align-items: center;
-				font-size: 16rpx;
+				font-size: 24rpx;
 				font-family: PingFang SC-Regular, PingFang SC;
-				color: #666666;
-
-				.value {
-					margin-top: -6rpx;
+				color: #999999;
+
+				.title {
+					display: flex;
+					width: 90%;
+					height: 40rpx;
+					font-size: 28rpx;
+					font-weight: 600;
+					color: #333333;
+
+					.line-1 {
+						max-width: 380rpx;
+					}
+
+					.tag {
+						display: inline-block;
+						color: #fff;
+						background-color: #F80700;
+						padding: 0 20rpx;
+						margin-left: 20rpx;
+						border-radius: 20rpx;
+						font-weight: normal;
+						font-size: 22rpx;
+						line-height: 40rpx;
+					}
 				}
 
-				.name {
-					margin-top: 6rpx;
+				.subfield {
+					display: flex;
+					margin-top: 8rpx;
+					height: 34rpx;
+					line-height: 34rpx;
+
+					text {
+						display: inline-block;
+						width: 48%;
+					}
 				}
-			}
-		}
-	}
 
-	.main {
-		position: relative;
-		box-sizing: border-box;
-		overflow: hidden;
+				.price {
+					font-size: 30rpx;
+					color: #FF3B30;
+				}
 
-		.label {
-			display: flex;
-			height: 42rpx;
+				.old-price {
+					font-size: 24rpx;
+					font-family: PingFang SC-Regular, PingFang SC;
+					color: #999999;
+					margin-left: 8rpx;
+					text-decoration-line: line-through;
+				}
 
-			.title {
-				flex: 1;
-				width: 0;
-				font-size: 30rpx;
-				font-family: PingFang SC-Regular, PingFang SC;
-				color: #333333;
-				margin-right: 20rpx;
 			}
 
-			.state {
-				flex-shrink: 0;
-				width: 132rpx;
-				height: 40rpx;
-				line-height: 40rpx;
-				border-radius: 20rpx 0px 0px 20rpx;
-				font-size: 24rpx;
-				font-family: PingFang SC-Regular, PingFang SC;
-				color: #FFFFFF;
-				text-align: center;
-			}
 
 		}
 
-		.tag-box {
+		.bottom {
+			width: 100%;
 			display: flex;
 			align-items: center;
-			width: 100%;
+			border-top: 1px solid #DDDDDD;
 
-			.datatag,
-			.systemtag {
-				flex-shrink: 0;
-				margin-top: 6rpx;
-				background: #3874f6;
-				color: #ffffff;
-				margin-right: 10rpx;
-				display: flex;
-				align-items: center;
-				height: 40rpx;
-				font-size: 20rpx;
-				padding: 0 10rpx;
-				border-radius: 20rpx;
-				font-family: PingFang SC-Regular, PingFang SC;
-			}
-
-			.datatag {
-				background: #FA8C16;
-			}
-		}
-
-		.replenish {
-			display: flex;
-			min-height: 34rpx;
-			font-size: 24rpx;
-			font-family: PingFang SC-Regular, PingFang SC;
-			color: #333333;
-			margin-top: 8rpx;
-			word-break: break-all;
-			white-space: pre-wrap;
-		}
+			>navigator,
+			>picker {
+				width: 50%;
+				text-align: center;
+				line-height: 92rpx;
+				font-family: PingFang SC, PingFang SC;
+				font-size: 28rpx;
+				color: #333333;
 
-		.leader {
-			position: absolute;
-			width: 60rpx;
-			height: 60rpx;
-			border-radius: 50%;
-			right: 30rpx;
-			bottom: 10rpx;
-			overflow: hidden;
+				.iconfont {
+					font-size: 28rpx;
+					margin-right: 10rpx;
+				}
 
-			image {
-				width: 100%;
-				height: 100%;
 			}
 
-			>view {
-				font-size: 28rpx;
-				font-family: PingFang SC-Regular, PingFang SC;
-				color: #FFFFFF;
-				background-color: #3874F6;
-				line-height: 60rpx;
-				text-align: center;
+			.set {
+				border-right: 1px solid #ddd;
 			}
 		}
 	}

+ 46 - 36
prsx/department/Product/index.wxml

@@ -13,43 +13,53 @@
 	</view>
 </view>
 
-<navigator url="/prsx/doctors/detail?id={{item.sa_doctorid}}" class="project-item" wx:for="{{list}}" wx:key="sa_doctorid">
-	<view class="main">
-		<view class="label">
-			{{item.doctorname}}
-		</view>
-		<view class="tag-box">
-			<view class="systemtag" wx:for="{{item.tag_sys}}" wx:key="item">{{item}}</view>
-			<view class="datatag" wx:for="{{item.tag}}" wx:key="item">{{item}}</view>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">联系方式:</text>
-			<text>{{item.phonenumber}}</text>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">职称:</text>
-			<text>{{item.professional}}</text>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">所属科室:</text>
-			<text>{{item.hospitaldepname || '--'}}</text>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">是否科室负责人:</text>
-			<text>{{item.isleader==0?'否':'是'}}</text>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">所属医院:</text>
-			<text>{{item.enterprisename || '--'}}</text>
-		</view>
-		<view class="replenish">
-			<text style="color: #666;">负责人:</text>
-			<text>{{item.leader[0].name}}</text>
+
+<view class="product-item" wx:for="{{list}}" wx:key="itemid">
+	<view class="product">
+		<view class="mian">
+			<view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
+				<van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
+					<van-loading slot="loading" type="spinner" size="20" vertical />
+				</van-image>
+				<text wx:else class="err">{{language['暂无图片']||'暂无图片'}}</text>
+			</view>
+			<view class="dec">
+				<view class="title">
+					<text class="line-1">{{item.itemname}}</text>
+				</view>
+				<view class="subfield">
+					<text class="line-1" style="margin-right: 6rpx;">编号:{{item.itemno||' --'}}</text>
+					<text class="line-1" style="margin-right: 6rpx;">备货分类:{{item.goodstype||' --'}}</text>
+				</view>
+				<view class="subfield">
+					<text class="line-1" style="margin-right: 6rpx;">型号:{{item.model||' --'}}</text>
+					<text class="line-1" style="margin-right: 6rpx;">规格:{{item.spec||' --'}}</text>
+				</view>
+				<view class="subfield">
+					辅助说明:{{item.assistance||' --'}}
+				</view>
+				<view class="subfield">
+					俗称释义:{{item.explains||' --'}}
+				</view>
+				<view class="subfield">
+					营销类别:{{item.itemclassname||' --'}}
+				</view>
+				<view class="subfield">
+					开发阶段:{{item.stagename||' --'}}
+				</view>
+			</view>
 		</view>
-		<view class="replenish">
-			<text style="color: #666;">备注:</text>
-			<text>{{item.remarks || '--'}}</text>
+		<view class="bottom" wx:if="{{disabled}}">
+			<navigator url='#' class="set" data-item="{{item}}" bind:tap="changeStage">
+				<text class="iconfont icon-shezhijieduan"></text>设置阶段
+			</navigator>
+			<navigator url='#' class="delete" data-item="{{item}}" bind:tap="deleteItem">
+				<text class="iconfont icon-shanchu1"></text>删除
+			</navigator>
 		</view>
 	</view>
-</navigator>
+</view>
+
+<van-action-sheet show="{{ showAction }}" actions="{{ stages }}" cancel-text="取消" z-index='9999999999999' bind:select='onSelect' bind:cancel="onCancel" bind:click-overlay='onCancel' />
+
 <My_empty wx:if="{{list.length==0}}" />

+ 26 - 1
prsx/select/product/index.js

@@ -40,6 +40,10 @@ Page({
                 title: res.data,
                 icon: "none"
             })
+            res.data = res.data.map(v => {
+                v.cover = v.attinfos.length ? _Http.getSpecifiedImage(v.attinfos[0]) : ''
+                return v
+            })
             this.setData({
                 'params.content.pageNumber': res.pageNumber + 1,
                 'params.content.pageTotal': res.pageTotal,
@@ -48,6 +52,26 @@ Page({
             })
         })
     },
+    uploadList() {
+        let params = JSON.parse(JSON.stringify(this.data.params));
+        params.content.pageSize = (params.content.pageNumber - 1) * params.content.pageSize;
+        params.content.pageNumber = 1;
+        _Http.basic(params).then(res => {
+            console.log("更新列表", res);
+            if (res.code != '1') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            res.data = res.data.map(v => {
+                v.cover = v.attinfos.length ? _Http.getSpecifiedImage(v.attinfos[0]) : ''
+                return v
+            })
+            this.setData({
+                'params.content.total': res.total,
+                list: res.data
+            })
+        })
+    },
     /* 选中 */
     changeResult(e) {
         let {
@@ -78,8 +102,9 @@ Page({
                     return data ? data[this.data.showName] : ""
                 }), result]
             }
-        getApp().globalData.handleSelect && getApp().globalData.handleSelect(obj)
+        _Http.handleSelect && _Http.handleSelect(obj)
     },
+
     /* 开始搜索 */
     startSearch({
         detail

+ 4 - 4
prsx/select/product/index.wxml

@@ -2,8 +2,8 @@
 </van-search>
 <view class="global-total">总共{{params.content.total}}个</view>
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
-    <view class="global-card product-item" wx:for="{{list}}" wx:key="itemid">
-        <navigator class="product" url="#">
+    <navigator url="#" class="global-card product-item" wx:for="{{list}}" wx:key="itemid" data-id="{{item.itemid}}" bind:tap="changeResult">
+        <view class="product" url="#">
             <view class="mian">
                 <view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
                     <van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
@@ -37,8 +37,8 @@
                     <text class="iconfont icon-guanlian-shanchu" />
                 </view>
             </view>
-        </navigator>
-    </view>
+        </view>
+    </navigator>
     <view wx:if="{{!radio}}" style="height: 70rpx;" />
     <My_empty wx:if="{{!list.length}}" />
 </Yl_ListBox>

+ 21 - 0
utils/Http.js

@@ -34,6 +34,27 @@ class HTTP {
             return content;
         }
 
+        //得到缩略图或者压缩图  getType默认得到缩略图传true得到压缩图
+        this.getSpecifiedImage = (obj, getType = false) => {
+            obj.url = this.getImageUrl(obj.url)
+            try {
+                let type = getType ? 'compressed' : 'thumbnail';
+                let imgObj = obj.subfiles.find(v => v.type == type);
+                return this.getImageUrl(imgObj.url || obj.url);
+            } catch (error) {
+                return this.getImageUrl(obj.url);
+            }
+        }
+
+        // 判断图片是本地还是云存储
+        this.getImageUrl = (url) => {
+            if (!url) return '';
+            //判断url中是否存在http,没有的话要拼接 this.baseUrl
+            if (!/^https?:\/\//.test(url)) {
+                url = _Http.baseUrl + url + wx.getStorageSync('userMsg').token;
+            }
+            return url;
+        }
 
         this.getTabs = (that, ownertable, list = [], _Http) => {
             if (list.length) _Http.basic({