userAuth.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="content">
  3. <view class="steps">
  4. <u-steps :list="numList" active-color="#00aaff" :current="current"></u-steps>
  5. </view>
  6. <view class="step1" v-if="current==0">
  7. <view class="form-row form-flex">
  8. <view><text class="red">*</text>网点名称</view>
  9. <view>啊撒旦解放拉风小区</view>
  10. </view>
  11. <view class="form-row form-flex">
  12. <view><text class="red">*</text>投递手机号</view>
  13. <view>
  14. <u-input v-model="formData.phone" type="number" input-align="right" :custom-style="{color: '#666'}" :maxlength="11" placeholder="请输入手机号码"></u-input>
  15. </view>
  16. </view>
  17. <view class="form-row">
  18. <view><text class="red">*</text>投递类型</view>
  19. <view class="form-grid">
  20. <view class="active">
  21. <view>废旧纸张</view>
  22. <view class="texts">200g/1乐豆</view>
  23. </view>
  24. <view>
  25. <view>废旧纸张</view>
  26. <view class="texts">200g/1乐豆</view>
  27. </view>
  28. <view>
  29. <view>废旧纸张</view>
  30. <view class="texts">200g/1乐豆</view>
  31. </view>
  32. <view>
  33. <view>废旧纸张</view>
  34. <view class="texts">200g/1乐豆</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="step2" v-if="current==1">
  40. <view class="form-row form-flex">
  41. <view>投递手机号</view>
  42. <view>13709146191</view>
  43. </view>
  44. <view class="form-row form-flex">
  45. <view>用户乐豆余额</view>
  46. <view><text>560</text></view>
  47. </view>
  48. <view class="form-row form-flex">
  49. <view>投递类型</view>
  50. <view>
  51. 废旧衣服
  52. <text class="des">(200g/1乐豆)</text>
  53. </view>
  54. </view>
  55. <view class="form-row form-flex">
  56. <view>投递重量</view>
  57. <view><text class="nums">{{balanceData}}g</text></view>
  58. </view>
  59. <view class="form-row form-flex">
  60. <view>可兑换乐豆数</view>
  61. <view><text class="nums">10</text></view>
  62. </view>
  63. </view>
  64. <view class="buttons">
  65. <view v-if="current==0" ><u-button shape="circle" :custom-style="customStyle" @click="next()" type="primary">下一步</u-button></view>
  66. <view v-if="current==1"><u-button shape="circle" @click="prev()">上一步</u-button></view>
  67. <view v-if="current==1"><u-button shape="circle" @click="submit()" :custom-style="customStyle" type="primary">提交</u-button></view>
  68. </view>
  69. <!-- 提交确认弹框 -->
  70. <u-modal v-model="showOk" show-cancel-button @confirm="confirm" @cancel="cancel">
  71. <view class="slot-content">
  72. <rich-text :nodes="modelContent"></rich-text>
  73. </view>
  74. </u-modal>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. showOk: false,
  82. modelContent:'',
  83. customStyle: {
  84. background: '#00aaff'
  85. },
  86. current: 0,
  87. numList: [{
  88. name: '用户认证'
  89. }, {
  90. name: '称重'
  91. }],
  92. formData:{
  93. address: '',
  94. phone: '',
  95. washType: '0'
  96. }
  97. }
  98. },
  99. computed: {
  100. balanceData() {
  101. let data = this.$store.state.vuex_balanceData
  102. console.log(data.split(','))
  103. let weight = data.split(',')[2]
  104. let uit = ''
  105. let fh = ''
  106. weight = weight.replace('\n','')
  107. // 符号位
  108. if(weight.indexOf('+')>=0){
  109. fh = '+'
  110. }
  111. if(weight.indexOf('-')>=0){
  112. fh = '-'
  113. }
  114. // 解析数字
  115. if(weight.indexOf('kg')>0){
  116. weight = weight.replace(/\+|-|[kg]/g,'')
  117. console.log(weight,'kg-weight')
  118. weight = Number(weight) * 1000
  119. uit = 'kg'
  120. }else if(weight.indexOf('lb')>0){
  121. weight = weight.replace(/\+|-|[lb]/g,'')
  122. console.log(weight,'lb-weight')
  123. weight = Math.floor(Number(weight) * 453.59237)
  124. uit = 'lb'
  125. }else{
  126. weight = weight.replace(/\+|-|g/g,'')
  127. console.log(weight,'g-weight')
  128. weight = Number(weight)
  129. uit = 'g'
  130. }
  131. console.log(weight,uit,fh,'weight end')
  132. return fh + weight
  133. }
  134. },
  135. methods: {
  136. next(){
  137. if(this.formData.phone == ''){
  138. uni.showToast({
  139. icon: 'none',
  140. title: '请输入手机号码'
  141. })
  142. return
  143. }
  144. if(this.formData.washType == ''){
  145. uni.showToast({
  146. icon: 'none',
  147. title: '请选择投递类型'
  148. })
  149. return
  150. }
  151. this.current = this.current + 1
  152. },
  153. prev(){
  154. this.current = this.current - 1
  155. },
  156. submit(){
  157. this.showOk = true
  158. this.modelContent = `
  159. <div>
  160. <div style="font-weight:bold;padding:10px 0;">投递重量:<span style="color:red">${this.balanceData}</span> g</div>
  161. <div>提交后将为此用户计入本次投递数据,确认提交吗?</div>
  162. </div>
  163. `
  164. },
  165. cancel(){
  166. this.showOk = false
  167. this.modelContent = ''
  168. },
  169. // 确认提交
  170. confirm(){
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="less">
  176. .content{
  177. width: 100%;
  178. padding: 20rpx;
  179. background-color: #FFFFFF;
  180. .steps{
  181. padding: 40rpx 0;
  182. border-bottom: 1px solid #f8f8f8;
  183. }
  184. .form-flex{
  185. display: flex;
  186. align-items: center;
  187. > view{
  188. &:first-child{
  189. width: 30%;
  190. }
  191. &:last-child{
  192. width: 70%;
  193. text-align: right;
  194. color: #666;
  195. }
  196. }
  197. }
  198. .form-row{
  199. border-bottom: 1px solid #f8f8f8;
  200. padding: 20rpx 15rpx;
  201. position: relative;
  202. .red{
  203. color: red;
  204. margin-right: 6rpx;
  205. }
  206. .des{
  207. color: #666;
  208. margin-left: 5rpx;
  209. font-size: 24rpx;
  210. }
  211. .nums{
  212. color: red;
  213. margin-right: 5rpx;
  214. }
  215. }
  216. .form-grid{
  217. display: flex;
  218. align-items: center;
  219. flex-wrap: wrap;
  220. justify-content: space-around;
  221. > view{
  222. width: 45%;
  223. border: 1px solid #eee;
  224. margin: 20rpx 0;
  225. padding: 20rpx;
  226. border-radius: 6rpx;
  227. text-align: center;
  228. .texts{
  229. font-size: 24rpx;
  230. color: #999;
  231. padding: 10rpx 0;
  232. }
  233. }
  234. .active{
  235. border-color: #ffaa00;
  236. background-color: #ffd36a;
  237. color: #FFFFFF;
  238. .texts{
  239. color: #FFFFFF;
  240. }
  241. }
  242. }
  243. .buttons{
  244. padding: 50rpx 5%;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. >view{
  249. width: 50%;
  250. padding: 0 5%;
  251. }
  252. }
  253. .slot-content{
  254. padding: 50rpx;
  255. }
  256. }
  257. </style>