checkOut.vue 6.2 KB

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