page-head.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <view class="bg-white padding-lr-15 uni-top">
  4. <view class="flex justify-between top-button">
  5. <uni-easyinput :prefixIcon="searchShow ? 'bottom' : 'right'" suffixIcon="search"
  6. v-model="queryfrom.styleNum" placeholder="搜索工厂款号" @iconClick="iconClick" @confirm="getData(1)">
  7. </uni-easyinput>
  8. <view v-if="showQutation" style="width: 60px;margin-left: 10rpx;">
  9. <button @click="goQutation" type="primary" class="import-btn">
  10. <view style="font-size: 16px;">报价</view>
  11. </button>
  12. </view>
  13. <view style="margin-top: -4px;margin-left: 5rpx;">
  14. <uni-icons @click="scan" type="scan" size="43" color="#409EFF"></uni-icons>
  15. </view>
  16. </view>
  17. <view class="flex" v-if="searchShow">
  18. <view class="flex-sub padding-left-xs padding-top-xs">
  19. <uni-easyinput v-model="queryfrom.version" placeholder="搜索版本号"
  20. @confirm="getData(1)"></uni-easyinput>
  21. <uni-easyinput style="margin-top: 5px;" v-model="queryfrom.color" placeholder="搜索颜色"
  22. @confirm="getData(1)"></uni-easyinput>
  23. </view>
  24. </view>
  25. <view class="flex justify-between padding-top-sm" v-if="searchShow">
  26. <button class="mini-btn" type="default" size="mini" @click="searchShow = !searchShow">
  27. <text class="cuIcon-fold" style="margin-right: 5px;"></text>收回
  28. </button>
  29. <button class="mini-btn" type="primary" size="mini" @click="getData(1)">搜索</button>
  30. </view>
  31. </view>
  32. <view style="padding: 20px;" class="padding">
  33. </view>
  34. <uni-popup style="width: 100%;" class="" ref="popup" type="dialog" border-radius="10px 10px 10px 10px">
  35. <div style="width: 100%;" class="bg-white">我是分界线</div>
  36. </uni-popup>
  37. </view>
  38. </template>
  39. <script>
  40. /**
  41. * Section 标题栏
  42. * @description 标题栏
  43. * @property {String} type = [line|circle|square] 标题装饰类型
  44. * @value line 竖线
  45. * @value circle 圆形
  46. * @value square 正方形
  47. * @property {String} title 主标题
  48. * @property {String} titleFontSize 主标题字体大小
  49. * @property {String} titleColor 主标题字体颜色
  50. * @property {String} subTitle 副标题
  51. * @property {String} subTitleFontSize 副标题字体大小
  52. * @property {String} subTitleColor 副标题字体颜色
  53. * @property {String} padding 默认插槽 padding
  54. */
  55. import jweixin from 'weixin-js-sdk'
  56. import {
  57. getSign
  58. } from '@/api/trade/shoe-style.js'
  59. export default {
  60. name: 'pageHead',
  61. emits: ['click'],
  62. props: {
  63. showQutation: {
  64. type: Boolean,
  65. default: true
  66. },
  67. },
  68. data() {
  69. return {
  70. searchShow: false,
  71. getSign: getSign,
  72. queryfrom: {
  73. version: '',
  74. styleNum: '',
  75. color: ''
  76. }
  77. }
  78. },
  79. created() {
  80. this.getConfig()
  81. },
  82. methods: {
  83. goQutation() {
  84. uni.navigateTo({
  85. url: '/pages/trade/quotation/QuotationAdd'
  86. })
  87. },
  88. openPopup() {
  89. this.$refs.popup.open('center')
  90. },
  91. getConfig() {
  92. this.getSign({
  93. url: location.href,
  94. appid: 'wx2cfd24c7380cdc08',
  95. }).then(res => {
  96. var s = res.data
  97. jweixin.config({
  98. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  99. appId: s.appId, // 必填,公众号的唯一标识
  100. timestamp: s.timestamp, // 必填,生成签名的时间戳
  101. nonceStr: s.nonceStr, // 必填,生成签名的随机串
  102. signature: s.signature, // 必填,签名
  103. jsApiList: ['scanQRCode'] // 必填,需要使用的JS接口列表
  104. })
  105. })
  106. },
  107. scan() {
  108. const _this = this
  109. jweixin.scanQRCode({
  110. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  111. scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
  112. success: function(res) {
  113. let str = res.resultStr // 当needResult 为 1 时,扫码返回的结果
  114. // let exURL = "https://zhtool.huaxiazhizao.com/pages/trade/shoe-style/ShoeStyleView?data=1";
  115. let encodedURL = encodeURI(str)
  116. // console.log(encodedURL)
  117. window.location.href = encodedURL
  118. }
  119. })
  120. },
  121. iconClick(type) {
  122. if (type === 'prefix') {
  123. this.searchShow = !this.searchShow
  124. } else {
  125. this.$emit('headGetData', this.queryfrom)
  126. };
  127. // uni.showToast({
  128. // title: `点击了${type==='prefix'?'左侧':'右侧'}的图标`,
  129. // icon: 'none'
  130. // })
  131. },
  132. getData() {
  133. this.$emit('headGetData', this.queryfrom)
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. .uni-top {
  140. position: fixed;
  141. top: 0;
  142. left: 0;
  143. right: 0;
  144. }
  145. </style>