checkOut.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="page-content">
  3. <view class="content">
  4. <u-field
  5. class="field-item"
  6. :value="store.name"
  7. disabled
  8. input-align="right"
  9. label="收取门店"
  10. >
  11. </u-field>
  12. <u-field
  13. v-model="remarks"
  14. label="备注"
  15. input-align="right"
  16. auto-height
  17. :maxlength="10"
  18. placeholder="请填写备注(最多10个字符)"
  19. >
  20. </u-field>
  21. <view class="num-cont">
  22. <text class="u-required">支付数量</text>
  23. <view class="num-input">
  24. <u-input v-model="number" input-align="right" type="number" placeholder="请输入数量" />
  25. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="pay-btn">
  30. <view class="total">
  31. <text>{{number||0}}</text>
  32. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  33. </view>
  34. <u-button @click="handlePay" type="success" >确认支付</u-button>
  35. </view>
  36. <!-- 确认支付弹窗 -->
  37. <u-popup mode="center" closeable @close="closeModal" negative-top="150" v-model="showPayModal" width="600rpx" >
  38. <view class="slot-content">
  39. <view class="slot-title">请输入支付密码</view>
  40. <view class="text-cont">
  41. <view>
  42. <text>收取门店:</text>
  43. <text>{{store.name||'--'}}</text>
  44. </view>
  45. <view class="num-text">
  46. <text>支付数量:</text>
  47. <view>
  48. <text class="num-big">{{number}}</text>
  49. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  50. </view>
  51. </view>
  52. <view>
  53. <text>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
  54. <text>{{remarks||'无'}}</text>
  55. </view>
  56. </view>
  57. <view class="footer">
  58. <input v-model="password"
  59. type="password"
  60. :focus="focus"
  61. placeholder="请输入支付密码"
  62. :maxlength="30"
  63. @confirm="confirm"
  64. />
  65. </view>
  66. <view class="fot-btn">
  67. <u-button @click="confirm" type="success" >确认支付</u-button>
  68. </view>
  69. </view>
  70. </u-popup>
  71. <!-- 提示用户设置支付密码 -->
  72. <u-modal v-model="showSetPswModal"
  73. content="请先设置支付密码,才能使用乐豆"
  74. show-cancel-button
  75. confirm-text="去设置"
  76. cancel-text="暂时放弃"
  77. @confirm="toSetPwd"
  78. @cancel="showSetPswModal=false"
  79. ></u-modal>
  80. </view>
  81. </template>
  82. <script>
  83. import { sellerReceive } from '@/api/user.js'
  84. import { existPayPwd } from '@/api/order.js'
  85. export default{
  86. data() {
  87. return {
  88. showSetPswModal: false,
  89. store: null, // 门店信息
  90. remarks: '', // 备注
  91. number: '', // 支付数量
  92. showPayModal: false, // 支付弹窗
  93. password: '', // 支付密码
  94. partnerNo: '', // 销售商编号
  95. currentGold: 0, //用户当前拥有乐豆数
  96. focus: false
  97. }
  98. },
  99. onLoad(opts) {
  100. this.currentGold = this.$store.state.vuex_userData.currentGold
  101. console.log(this.currentGold,'currentGold')
  102. this.store = JSON.parse(decodeURIComponent(opts.store))
  103. this.partnerNo = this.store.officialPartnerNo
  104. // console.log(this.store,'22222')
  105. },
  106. methods: {
  107. // 跳转到设置支付密码页
  108. toSetPwd () {
  109. uni.navigateTo({
  110. url:"/pages/userCenter/userInfo/smsVerification"
  111. })
  112. },
  113. // 确认支付
  114. handlePay() {
  115. if (!this.number) {
  116. uni.showToast({
  117. title: '请输入支付数量',
  118. icon: 'none'
  119. })
  120. } else {
  121. if (this.number>this.currentGold) {
  122. uni.showToast({
  123. title: '您当前余额不足!',
  124. icon: 'none'
  125. })
  126. return false
  127. }
  128. existPayPwd().then(res => {
  129. console.log(res,'rrrrrr')
  130. if(res.status == 200) {
  131. // 设置过支付密码,输入密码
  132. if(res.data) {
  133. this.showPayModal = true
  134. setTimeout(()=>{
  135. this.focus = true
  136. },300)
  137. } else {
  138. // 没设置过支付密码,提示设置密码
  139. this.showSetPswModal = true
  140. }
  141. }
  142. })
  143. }
  144. },
  145. // 关闭弹窗
  146. closeModal() {
  147. this.showPayModal = false
  148. this.password = ''
  149. },
  150. // 输入密码完成 支付
  151. confirm(e) {
  152. if(this.password == ''){
  153. uni.showToast({
  154. title: '请输入支付密码',
  155. icon: 'none'
  156. })
  157. return
  158. }
  159. let data = {
  160. "payPassword": this.password,
  161. "changeNum": this.number,
  162. "remarks": this.remarks,
  163. "officialPartnerNo": this.partnerNo
  164. }
  165. sellerReceive(data).then(res => {
  166. console.log(res)
  167. if(res.status == 200){
  168. uni.redirectTo({
  169. url: '/pages/checkOut/checkFinish?num='+this.number
  170. })
  171. }
  172. })
  173. }
  174. },
  175. }
  176. </script>
  177. <style lang="less">
  178. page{
  179. height: 100%;
  180. }
  181. .page-content{
  182. width: 100%;
  183. height: 100%;
  184. padding: 20upx;
  185. background-color: #f8f8f8;
  186. .content{
  187. background-color: #fff;
  188. }
  189. .num-cont{
  190. width: 100%;
  191. padding: 16upx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. .num-input{
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. >u-input {
  200. width: 300upx;
  201. }
  202. }
  203. }
  204. .pay-btn{
  205. padding: 0 30upx;
  206. .total {
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. font-size: 48upx;
  211. font-weight: 600;
  212. color: red;
  213. padding: 60upx 0;
  214. }
  215. }
  216. }
  217. .slot-content{
  218. padding: 30upx 0;
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. justify-content: space-between;
  223. .slot-title{
  224. font-size: 36rpx;
  225. }
  226. .text-cont{
  227. width: 100%;
  228. margin-top: 20upx;
  229. // font-size: 20rpx;
  230. >view {
  231. padding: 10upx 80upx;
  232. display: flex;
  233. >text{
  234. &:last-child {
  235. flex: 1;
  236. padding-left: 30upx;
  237. }
  238. }
  239. .num-big{
  240. font-size: 36upx;
  241. color: red;
  242. padding-left: 30upx;
  243. font-weight: 600;
  244. }
  245. }
  246. .num-text{
  247. align-items: center;
  248. >view {
  249. display: flex;
  250. align-items: center;
  251. }
  252. }
  253. }
  254. .footer{
  255. width: 80%;
  256. border-bottom: 1px solid #b1b1b1;
  257. >input {
  258. text-align: center;
  259. padding: 10upx 0;
  260. }
  261. }
  262. .fot-btn{
  263. margin-top: 30upx;
  264. }
  265. }
  266. </style>