合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
11 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <scroll-view class="container" lower-threshold='50' @scrolltolower ='scrolltolower'>
  3. <view class="header">
  4. <view class="header_info" >
  5. <view class="header_info_icon" @click.native.stop.prevent="toBack" style="display: flex; justify-content: center; align-items: center;">
  6. <uni-icons type="left" size="30" color="#c2d4de" > </uni-icons>
  7. </view>
  8. <text class="header_text" >录入订单</text>
  9. </view>
  10. </view>
  11. <!-- 搜索栏 -->
  12. <view class="search-box">
  13. <uni-icons class=" isshow-header-content-icon" type="search" :size="20"></uni-icons>
  14. <uni-easyinput :inputBorder="false" class=" search-input" v-model="searchKey" placeholder="请输入客户姓名/客户手机号" :focus="firstFocus" @clear = 'clear' />
  15. <button @tap="handleSearch" class="search-btn" hover-class="none">搜索</button>
  16. </view>
  17. <!-- 订单状态筛选 -->
  18. <view class="filter-tabs">
  19. <text
  20. v-for="tab in tabs"
  21. :key="tab"
  22. :class="['tab-item', activeTab === tab ? 'active' : '']"
  23. @tap="changeStatus(tab)"
  24. >
  25. {{ tab }}
  26. </text>
  27. </view>
  28. <!-- 订单列表 -->
  29. <view
  30. v-for="(order, index) in filteredOrders"
  31. :key="index"
  32. class="order-item"
  33. >
  34. <view class="order-header">
  35. <text class="order-no">{{ order.orderNum }}</text>
  36. <text class="copy-btn" @tap="copyorderNum(order.orderNum)">复制</text>
  37. </view>
  38. <view class="order-info">
  39. <text>客户姓名:{{ order.custName }}</text>
  40. <text>联系方式:{{ order.custPhone }}</text>
  41. <text>服务名称:{{ order.productName }}</text>
  42. <text>订单时间:{{ order.createTime }}</text>
  43. <text>销售人员:{{ order.saleName }}</text>
  44. <text>门店名称:{{ order.storeName }}</text>
  45. </view>
  46. <button class="download-btn" @tap="downloadPDF(order.contractUrl)" v-if='order.status == 1 && order.productType == "普通产品" ? true : false'>PDF下载</button>
  47. <button class="download-btns" @tap="look(order.id,order.productType)" >查看详情</button>
  48. <image src="/static/image/组 71693.png" v-if='order.status == 1 ? true : false' class="status"></image>
  49. <image src="/static/image/组 71697.png" v-if='order.status == 1 ? false : true' class="status"></image>
  50. </view>
  51. </scroll-view>
  52. </template>
  53. <script>
  54. import {list,isToken,addContract} from '@/api.uts'
  55. export default {
  56. data() {
  57. return {
  58. params:{
  59. pageNo: 1,
  60. pageSize: 10,
  61. status: ''
  62. },
  63. firstFocus:false,
  64. searchKey: '', // 搜索关键词
  65. activeTab: '全部', // 当前激活的标签
  66. tabs: ['全部', '已生效', '已失效'],
  67. orders: [/* 从接口获取的数据 */]
  68. }
  69. },
  70. mounted() {
  71. isToken();
  72. uni.showLoading({ title: '查询中...' })
  73. setTimeout(() => { //打开文档查看
  74. list({pageNo:1,pageSize:10}).then((res)=>{
  75. for (var index = 0; index < res.result.records.length; index++) {
  76. this.orders.push( res.result.records[index])
  77. }
  78. })
  79. uni.hideLoading();
  80. }, 1000)
  81. },
  82. onShow() {
  83. this.orders.splice(0);
  84. uni.showLoading({ title: '查询中...' })
  85. setTimeout(() => { //打开文档查看
  86. list({pageNo:1,pageSize:10}).then((res)=>{
  87. for (var index = 0; index < res.result.records.length; index++) {
  88. this.orders.push( res.result.records[index])
  89. }
  90. })
  91. uni.hideLoading();
  92. }, 1000)
  93. },
  94. computed: {
  95. filteredOrders() {
  96. return this.orders.filter((item) => {
  97. // 根据多种类型来搜索
  98. return item.custName.includes(this.searchKey) || item.custPhone.includes(this
  99. .searchKey)
  100. })
  101. }
  102. },
  103. methods: {
  104. // 清楚搜索框信息
  105. clear(){
  106. this.searchKey = '';
  107. },
  108. // 到底部刷新
  109. scrolltolower(){
  110. uni.showLoading({
  111. title: '刷新中..'
  112. })
  113. list(this.params).then((res)=>{
  114. let orders = res.result.records;
  115. for (var index = 0; index < orders.length; index++) {
  116. this.orders.push(orders[index]);
  117. }
  118. uni.hideLoading();
  119. })
  120. this.params.pageNo++
  121. },
  122. changeStatus(status){
  123. uni.showLoading();
  124. this.activeTab = status;
  125. if(status== '已生效'){
  126. this.orders.splice(0)
  127. this.params.status = 1;
  128. this.params.pageNo= 1;
  129. list(this.params).then((res)=>{
  130. let orders = res.result.records;
  131. for (var index = 0; index < orders.length; index++) {
  132. this.orders.push(orders[index]);
  133. }
  134. uni.hideLoading();
  135. })
  136. }else if (status== '已失效'){
  137. this.orders.splice(0);
  138. this.params.status = 2;
  139. this.params.pageNo= 1
  140. list(this.params).then((res)=>{
  141. for (var index = 0; index < res.result.records.length; index++) {
  142. this.orders.push(res.result.records[index]);
  143. }
  144. })
  145. uni.hideLoading();
  146. }else{
  147. this.params.status = '';
  148. this.params.pageNo= 1
  149. list(this.params).then((res)=>{
  150. console.log(res.result)
  151. this.orders.splice(0);
  152. for (var index = 0; index < res.result.records.length; index++) {
  153. this.orders.push(res.result.records[index]);
  154. }
  155. uni.hideLoading();
  156. })
  157. }
  158. },
  159. // 回退
  160. toBack(){
  161. let canNavBack = getCurrentPages()
  162. if( canNavBack && canNavBack.length>1) {
  163. uni.navigateBack()
  164. } else {
  165. history.back();
  166. }
  167. },
  168. IsChinese(value) {
  169. const reg = /^[\u4e00-\u9fa5]+$/gi;
  170. return reg.test(value);
  171. },
  172. WhNumber(value) {
  173. return /^\d+$/.test(value);
  174. },
  175. // 搜索处理
  176. handleSearch() {
  177. // 实际调用接口获取数据
  178. uni.showLoading();
  179. // console.log(this.IsChinese(this.searchKey));
  180. if(this.IsChinese(this.searchKey)){
  181. list({custName:this.searchKey,pageNo:1,pageSize:10}).then((res)=>{
  182. this.activeTab = '全部';
  183. this.orders.splice(0);
  184. let orders = res.result.records;
  185. for (var index = 0; index < orders.length; index++) {
  186. this.orders.push(orders[index]);
  187. }
  188. uni.hideLoading();
  189. })
  190. }else if(this.WhNumber(this.searchKey)){
  191. list({custPhone:this.searchKey,pageNo:1,pageSize:10}).then((res)=>{
  192. this.activeTab = '全部';
  193. this.orders.splice(0);
  194. let orders = res.result.records;
  195. for (var index = 0; index < orders.length; index++) {
  196. this.orders.push(orders[index]);
  197. }
  198. uni.hideLoading();
  199. })
  200. }else if(!this.searchKey){
  201. list({pageNo:1,pageSize:10}).then((res)=>{
  202. this.activeTab = '全部';
  203. this.orders.splice(0);
  204. let orders = res.result.records;
  205. for (var index = 0; index < orders.length; index++) {
  206. this.orders.push(orders[index]);
  207. }
  208. uni.hideLoading();
  209. })
  210. }
  211. },
  212. // 复制订单号
  213. copyorderNum(orderNum) {
  214. uni.setClipboardData({
  215. data: orderNum,
  216. success: () => {
  217. uni.showToast({ title: '复制成功' })
  218. }
  219. })
  220. },
  221. // PDF下载
  222. async downloadPDF(contractUrl) {
  223. uni.showLoading({ title: '下载中...' })
  224. // 1. 调用下载接口
  225. console.log(contractUrl);
  226. uni.downloadFile({
  227. url: contractUrl,//下载地址接口返回
  228. success: (data) => {
  229. console.log(data);
  230. uni.saveFile({
  231. tempFilePath: data.tempFilePath, //临时路径
  232. // filePath:"内部存储/Documents/",
  233. success: (res)=> {
  234. uni.hideLoading();
  235. uni.showToast({
  236. icon: 'none',
  237. mask: true,
  238. title: '文件已下载,打开后请点击右上角保存!', //保存路径
  239. duration: 2000,
  240. });
  241. setTimeout(() => { //打开文档查看
  242. uni.openDocument({
  243. filePath: res.savedFilePath,
  244. showMenu:true,
  245. success: function(res) {
  246. // list({pageNo:1,pageSize:10}).then((res)=>{
  247. // for (var index = 0; index < res.result.records.length; index++) {
  248. // this.orders.push( res.result.records[index])
  249. // }
  250. // })
  251. }
  252. });
  253. }, 3000)
  254. }
  255. })
  256. },
  257. fail: (err) => {
  258. console.log(err);
  259. uni.showToast({
  260. icon: 'none',
  261. mask: true,
  262. title: '失败请重新下载',
  263. });
  264. },
  265. });
  266. },
  267. look(id,productType){
  268. getApp().id = id;
  269. if(productType == "普通产品"){
  270. getApp().productTypeFlag = true
  271. }else{
  272. getApp().productTypeFlag = false
  273. };
  274. uni.navigateTo(
  275. {
  276. url: '/pages/index/PayPal_xq'
  277. }
  278. )
  279. }
  280. }
  281. }
  282. </script>
  283. <style lang="scss" scoped>
  284. .search-box {
  285. height: 10%;
  286. display: flex;
  287. flex-direction: row;
  288. margin-bottom: 30rpx;
  289. align-items: center;
  290. .search-input {
  291. flex: 1;
  292. background: #fff;
  293. padding: 20rpx;
  294. border-radius: 8rpx;
  295. }
  296. .search-btn {
  297. width: 20%;
  298. height: 40%;
  299. margin-right: 10%;
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. font-size: 1rem;
  304. color: #044f7a;
  305. border: none;
  306. }
  307. .search-btn:after {
  308. border: none;
  309. }
  310. .isshow-header-content-icon{
  311. display: flex;
  312. justify-content: center;
  313. margin-left: 10%;
  314. align-items: center;
  315. }
  316. }
  317. .filter-tabs {
  318. display: flex;
  319. flex-direction: row;
  320. margin-bottom: 30rpx;
  321. position: relative;
  322. .tab-item {
  323. flex: 1;
  324. width: 10%;
  325. text-align: center;
  326. padding: 20rpx;
  327. color: #000000;
  328. border-bottom: 4rpx solid transparent;
  329. &.active {
  330. color: #044f7a;
  331. // border-bottom-color: #044f7a;
  332. }
  333. &.active:after {
  334. content: '';
  335. width: 50%;
  336. height: 1px;
  337. display: block;
  338. margin: 0 auto;
  339. border-bottom: 2px solid #044f7a;
  340. color: #044f7a;
  341. padding: 1px;
  342. }
  343. }
  344. }
  345. .order-item {
  346. margin: 0 auto;
  347. width: 80%;
  348. height: 30%;
  349. box-shadow: -0.1rem 0.1rem #e4e4e4;
  350. border: 1px solid #e1e1e1;
  351. border-radius: 0.5rem;
  352. position: relative;
  353. background: white;
  354. border-radius: 12rpx;
  355. margin-bottom: 20rpx;
  356. padding: 20rpx;
  357. .order-header {
  358. display: flex;
  359. flex-direction: row;
  360. justify-content: space-between;
  361. align-items: center;
  362. padding-bottom: 20rpx;
  363. border-bottom: 1rpx solid #eee;
  364. .order-no {
  365. color: #06507b;
  366. font-size: 28rpx;
  367. }
  368. .copy-btn {
  369. color: #06507b;
  370. font-size: 24rpx;
  371. }
  372. }
  373. .order-info {
  374. padding: 20rpx 0;
  375. text {
  376. display: block;
  377. color: #666;
  378. font-size: 24rpx;
  379. line-height: 1.8;
  380. }
  381. }
  382. .download-btn {
  383. width: 30%;
  384. height: 10%;
  385. background-color: #044f7a;
  386. position: absolute;
  387. color: #ffffff;
  388. bottom: 8%;
  389. right: 7%;
  390. font-size: 0.4rem;
  391. display: flex;
  392. justify-content: center;
  393. align-items: center;
  394. border-radius: 1rem;
  395. }
  396. .download-btns{
  397. width: 30%;
  398. height: 10%;
  399. background-color: #044f7a;
  400. position: absolute;
  401. color: #ffffff;
  402. bottom: 20%;
  403. right: 7%;
  404. font-size: 0.4rem;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. border-radius: 1rem;
  409. }
  410. }
  411. .status{
  412. position: absolute;
  413. width: 25%;
  414. height: 25%;
  415. right: 10%;
  416. top:30%
  417. }
  418. </style>